Skip to content

Commit aee971a

Browse files
committed
Fix the language of the documentation of the type alias Result.
The existing language stated that test functions *must* return `Result<()>`. This is not true in light of the `assert_*` family of macros and is no longer true when using `expect_*` in combination with `#[googletest::test]`. This change updates the docstring to indicate that a test function *may* return the type alias for fatal assertion failures and that some of the assertion macros evaluate to it.
1 parent 6e5405d commit aee971a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

googletest/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ use internal::test_outcome::{TestAssertionFailure, TestOutcome};
6262

6363
/// A `Result` whose `Err` variant indicates a test failure.
6464
///
65-
/// All test functions should return `Result<()>`.
65+
/// The assertions [`verify_that!`][crate::verify_that],
66+
/// [`verify_pred!`][crate::verify_pred], and [`fail!`][crate::fail] evaluate
67+
/// to `Result<()>`. A test function may return `Result<()>` in combination with
68+
/// those macros to abort immediately on assertion failure.
6669
///
6770
/// This can be used with subroutines which may cause the test to fatally fail
6871
/// and which return some value needed by the caller. For example:

0 commit comments

Comments
 (0)