]> git.lizzy.rs Git - rust.git/commitdiff
Rename should_fail to should_panic in docs
authorJohannes Oertel <johannes.oertel@uni-due.de>
Wed, 18 Mar 2015 21:34:40 +0000 (22:34 +0100)
committerManish Goregaokar <manishsmail@gmail.com>
Thu, 19 Mar 2015 02:54:38 +0000 (08:24 +0530)
src/doc/reference.md
src/doc/trpl/functions.md
src/doc/trpl/testing.md

index 3fae49bfc6d3ef23e166d125b9a8ea8f409ec2cc..92573d792177362ad724278699f3d9d13cd2839c 100644 (file)
@@ -2068,7 +2068,7 @@ type int8_t = i8;
   item](#language-items) for more details.
 - `test` - indicates that this function is a test function, to only be compiled
   in case of `--test`.
-- `should_fail` - indicates that this test function should panic, inverting the success condition.
+- `should_panic` - indicates that this test function should panic, inverting the success condition.
 - `cold` - The function is unlikely to be executed, so optimize it (and calls
   to it) differently.
 
index ca1385fde9c74950d8992e3e33646ba540a7a40c..8e8ee8d63d626e6112bf4ef46f86180cf0743e4d 100644 (file)
@@ -179,7 +179,7 @@ Because this function will cause a crash, it will never return, and so it has
 the type '`!`', which is read "diverges." A diverging function can be used
 as any type:
 
-```should_fail
+```should_panic
 # fn diverges() -> ! {
 #    panic!("This function never returns!");
 # }
index 537e100d7d830354782734de580653d90733dae2..72e9ec9f7509ad9ccab80dba6298a07d30f7c8cf 100644 (file)
@@ -129,11 +129,11 @@ $ echo $?
 
 This is useful if you want to integrate `cargo test` into other tooling.
 
-We can invert our test's failure with another attribute: `should_fail`:
+We can invert our test's failure with another attribute: `should_panic`:
 
 ```rust
 #[test]
-#[should_fail]
+#[should_panic]
 fn it_works() {
     assert!(false);
 }
@@ -163,13 +163,13 @@ equality:
 
 ```rust
 #[test]
-#[should_fail]
+#[should_panic]
 fn it_works() {
     assert_eq!("Hello", "world");
 }
 ```
 
-Does this test pass or fail? Because of the `should_fail` attribute, it
+Does this test pass or fail? Because of the `should_panic` attribute, it
 passes:
 
 ```bash
@@ -189,15 +189,15 @@ running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured
 ```
 
-`should_fail` tests can be fragile, as it's hard to guarantee that the test
+`should_panic` tests can be fragile, as it's hard to guarantee that the test
 didn't fail for an unexpected reason. To help with this, an optional `expected`
-parameter can be added to the `should_fail` attribute. The test harness will
+parameter can be added to the `should_panic` attribute. The test harness will
 make sure that the failure message contains the provided text. A safer version
 of the example above would be:
 
 ```
 #[test]
-#[should_fail(expected = "assertion failed")]
+#[should_panic(expected = "assertion failed")]
 fn it_works() {
     assert_eq!("Hello", "world");
 }