616af6eb83
The test harness will make sure that the panic message contains the specified string. This is useful to help make `#[should_fail]` tests a bit less brittle by decreasing the chance that the test isn't "accidentally" passing due to a panic occurring earlier than expected. The behavior is in some ways similar to JUnit's `expected` feature: `@Test(expected=NullPointerException.class)`. Without the message assertion, this test would pass even though it's not actually reaching the intended part of the code: ```rust #[test] #[should_fail(message = "out of bounds")] fn test_oob_array_access() { let idx: uint = from_str("13o").unwrap(); // oops, this will panic [1i32, 2, 3][idx]; } ``` |
||
---|---|---|
.. | ||
ast_map | ||
diagnostics | ||
ext | ||
parse | ||
util | ||
abi.rs | ||
ast_util.rs | ||
ast.rs | ||
attr.rs | ||
codemap.rs | ||
config.rs | ||
diagnostic.rs | ||
feature_gate.rs | ||
fold.rs | ||
lib.rs | ||
owned_slice.rs | ||
ptr.rs | ||
show_span.rs | ||
std_inject.rs | ||
test.rs | ||
visit.rs |