diff options
| author | bors <bors@rust-lang.org> | 2014-12-08 12:12:23 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-12-08 12:12:23 +0000 |
| commit | c7a9b49d1b5d4e520f25355f26a93dfac4ffa146 (patch) | |
| tree | 7a2a559658447be5fe71de276b7e8296b2999770 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | cf0b4e068227dd33fa15f3ffe24f29e0535d197f (diff) | |
| parent | a20926a51add66ab67053843e244efb1a4d7ad76 (diff) | |
| download | rust-c7a9b49d1b5d4e520f25355f26a93dfac4ffa146.tar.gz rust-c7a9b49d1b5d4e520f25355f26a93dfac4ffa146.zip | |
auto merge of #19560 : sfackler/rust/should-fail-reason, r=alexcrichton
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];
}
```
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
