mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-02 06:28:20 +03:00
Auto merge of #1082 - RalfJung:panic, r=RalfJung
test more panics Add some tests for https://github.com/rust-lang/miri/issues/1071. Blocked on https://github.com/rust-lang/rust/pull/66844.
This commit is contained in:
@@ -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());
|
||||
|
||||
@@ -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', $DIR/catch_panic.rs:52:21
|
||||
Caught panic message (String): Hello from panic: core
|
||||
thread 'main' panicked at 'Hello from panic: 5', $DIR/catch_panic.rs:53:20
|
||||
Caught panic message (String): Hello from panic: 5
|
||||
thread 'main' panicked at 'Hello from panic: 6', $DIR/catch_panic.rs:54:20
|
||||
Caught panic message (String): Hello from panic: 6
|
||||
Success!
|
||||
|
||||
Reference in New Issue
Block a user