@@ -182,21 +182,19 @@ failed, but execution continues until the test completes or otherwise aborts.
182
182
183
183
This is analogous to the ` EXPECT_* ` family of macros in GoogleTest.
184
184
185
- To make a non-fatal assertion, invoke the method [ ` and_log_failure() ` ] on the
186
- output of the assertion macro. The test must also be marked with
187
- [ ` google_test ` ] instead of the Rust-standard ` #[test] ` . It must return
188
- [ ` Result<()> ` ] .
185
+ To make a non-fatal assertion, use the macro [ ` expect_that! ` ] . The test must
186
+ also be marked with [ ` google_test ` ] instead of the Rust-standard ` #[test] ` . It
187
+ must return [ ` Result<()> ` ] .
189
188
190
189
``` rust
191
190
use googletest :: {
192
- google_test, matchers :: eq, verify_that, GoogleTestSupport , Result
191
+ expect_that, google_test, matchers :: eq, Result
193
192
};
194
193
195
194
#[google_test]
196
195
fn more_than_one_failure () -> Result <()> {
197
196
let value = 2 ;
198
- verify_that! (value , eq (3 )). and_log_failure (); // Just marks the test as
199
- // having failed.
197
+ expect_that! (value , eq (3 )); // Just marks the test as having failed.
200
198
verify_that! (value , eq (2 ))? ; // Passes, but the test already failed.
201
199
Ok (())
202
200
}
@@ -262,7 +260,8 @@ stuff_is_correct(x, y) was false with
262
260
```
263
261
264
262
The ` verify_pred! ` invocation evaluates to a [ ` Result<()> ` ] just like
265
- [ ` verify_that! ` ] .
263
+ [ ` verify_that! ` ] . There is also a macro [ ` expect_pred! ` ] to make a non-fatal
264
+ predicaticate assertion.
266
265
267
266
## Unconditionally generating a test failure
268
267
@@ -284,6 +283,8 @@ to this project.
284
283
285
284
[ `and_log_failure()` ] : https://docs.rs/googletest/*/googletest/trait.GoogleTestSupport.html#tymethod.and_log_failure
286
285
[ `assert_that!` ] : https://docs.rs/googletest/*/googletest/macro.assert_that.html
286
+ [ `expect_pred!` ] : https://docs.rs/googletest/*/googletest/macro.expect_pred.html
287
+ [ `expect_that!` ] : https://docs.rs/googletest/*/googletest/macro.expect_that.html
287
288
[ `fail!` ] : https://docs.rs/googletest/*/googletest/macro.fail.html
288
289
[ `google_test` ] : https://docs.rs/googletest/*/googletest/attr.google_test.html
289
290
[ `matches_pattern!` ] : https://docs.rs/googletest/*/googletest/macro.matches_pattern.html
0 commit comments