Type Definition googletest::Result
source · pub type Result<T> = Result<T, TestAssertionFailure>;
Expand description
A Result
whose Err
variant indicates a test failure.
All test functions should return Result<()>
.
This can be used with subroutines which may cause the test to fatally fail and which return some value needed by the caller. For example:
fn load_file_content_as_string() -> Result<String> {
let file_stream = load_file().err_to_test_failure()?;
Ok(file_stream.to_string())
}
The Err
variant contains a [TestAssertionFailure
] which carries the data
of the (fatal) assertion failure which generated this result. Non-fatal
assertion failures, which log the failure and report the test as having
failed but allow it to continue running, are not encoded in this type.