Change from message to expected
This commit is contained in:
@@ -369,7 +369,7 @@ fn should_fail(i: &ast::Item) -> ShouldFail {
|
|||||||
match i.attrs.iter().find(|attr| attr.check_name("should_fail")) {
|
match i.attrs.iter().find(|attr| attr.check_name("should_fail")) {
|
||||||
Some(attr) => {
|
Some(attr) => {
|
||||||
let msg = attr.meta_item_list()
|
let msg = attr.meta_item_list()
|
||||||
.and_then(|list| list.iter().find(|mi| mi.check_name("message")))
|
.and_then(|list| list.iter().find(|mi| mi.check_name("expected")))
|
||||||
.and_then(|mi| mi.value_str());
|
.and_then(|mi| mi.value_str());
|
||||||
ShouldFail::Yes(msg)
|
ShouldFail::Yes(msg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -374,7 +374,7 @@ Test Attributes:
|
|||||||
#[should_fail] - This function (also labeled with #[test]) will only pass if
|
#[should_fail] - This function (also labeled with #[test]) will only pass if
|
||||||
the code causes a failure (an assertion failure or panic!)
|
the code causes a failure (an assertion failure or panic!)
|
||||||
A message may be provided, which the failure string must
|
A message may be provided, which the failure string must
|
||||||
contain: #[should_fail(message = "foo")].
|
contain: #[should_fail(expected = "foo")].
|
||||||
#[ignore] - When applied to a function which is already attributed as a
|
#[ignore] - When applied to a function which is already attributed as a
|
||||||
test, then the test runner will ignore these tests during
|
test, then the test runner will ignore these tests during
|
||||||
normal test runs. Running with --ignored will run these
|
normal test runs. Running with --ignored will run these
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
// ignore-pretty: does not work well with `--test`
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_fail(message = "foobar")]
|
#[should_fail(expected = "foobar")]
|
||||||
fn test_foo() {
|
fn test_foo() {
|
||||||
panic!("blah")
|
panic!("blah")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,13 +12,13 @@
|
|||||||
// ignore-pretty: does not work well with `--test`
|
// ignore-pretty: does not work well with `--test`
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_fail(message = "foo")]
|
#[should_fail(expected = "foo")]
|
||||||
fn test_foo() {
|
fn test_foo() {
|
||||||
panic!("foo bar")
|
panic!("foo bar")
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[should_fail(message = "foo")]
|
#[should_fail(expected = "foo")]
|
||||||
fn test_foo_dynamic() {
|
fn test_foo_dynamic() {
|
||||||
panic!("{} bar", "foo")
|
panic!("{} bar", "foo")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user