Skip to content

Commit

Permalink
Auto merge of #1082 - RalfJung:panic, r=RalfJung
Browse files Browse the repository at this point in the history
test more panics

Add some tests for #1071.

Blocked on rust-lang/rust#66844.
  • Loading branch information
bors committed Dec 1, 2019
2 parents 33fe904 + 2f6c4a1 commit 4d6078d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/run-pass/catch_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ fn main() {
prev(panic_info)
}));

test(|_old_val| panic!("Hello from panic: std"));
test(|old_val| panic!(format!("Hello from panic: {:?}", old_val)));
test(|old_val| panic!("Hello from panic: {:?}", old_val));
test(|_old_val| panic!(1337));
// FIXME https://github.com/rust-lang/miri/issues/1071
//test(|_old_val| core::panic!("Hello from panic: core"));
//test(|old_val| core::panic!(&format!("Hello from panic: {:?}", old_val)));
//test(|old_val| core::panic!("Hello from panic: {:?}", old_val));
test(|_old_val| std::panic!("Hello from panic: std"));
test(|old_val| std::panic!(format!("Hello from panic: {:?}", old_val)));
test(|old_val| std::panic!("Hello from panic: {:?}", old_val));
test(|_old_val| std::panic!(1337));

test(|_old_val| core::panic!("Hello from panic: core"));
test(|old_val| core::panic!(&format!("Hello from panic: {:?}", old_val)));
test(|old_val| core::panic!("Hello from panic: {:?}", old_val));

// Cleanup: reset to default hook.
drop(std::panic::take_hook());
Expand Down
6 changes: 6 additions & 0 deletions tests/run-pass/catch_panic.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,10 @@ thread 'main' panicked at 'Hello from panic: 2', $DIR/catch_panic.rs:49:20
Caught panic message (String): Hello from panic: 2
thread 'main' panicked at 'Box<Any>', $DIR/catch_panic.rs:50:21
Failed get caught panic message.
thread 'main' panicked at 'Hello from panic: core', tests/run-pass/catch_panic.rs:52:21
Caught panic message (String): Hello from panic: core
thread 'main' panicked at 'Hello from panic: 5', tests/run-pass/catch_panic.rs:53:20
Caught panic message (String): Hello from panic: 5
thread 'main' panicked at 'Hello from panic: 6', tests/run-pass/catch_panic.rs:54:20
Caught panic message (String): Hello from panic: 6
Success!

0 comments on commit 4d6078d

Please sign in to comment.