Skip to content

Commit

Permalink
Add additional indirection to test
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed May 30, 2019
1 parent 5aa0f5c commit b909669
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/run-pass/catch_panic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ fn main() {
std::panic::set_hook(Box::new(|_panic_info| {
HOOK_CALLED.with(|h| h.set(true));
}));
let res = catch_unwind(do_panic_counter);
let res = catch_unwind(|| {
let _string = "LEAKED FROM CLOSURE".to_string();
do_panic_counter()
});
let expected: Box<String> = Box::new("Hello from panic: 0".to_string());
let actual = res.expect_err("do_panic() did not panic!")
.downcast::<String>().expect("Failed to cast to string!");
Expand Down

0 comments on commit b909669

Please sign in to comment.