Skip to content

Commit

Permalink
test: Make call stack interesting
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Oct 10, 2024
1 parent 9f6d0e8 commit d0d3995
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions tests/single-panic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ use human_panic::setup_panic;
fn main() {
setup_panic!();

call_inline_always()
}

fn call_inline_always() {
inline_always();
}

#[inline(always)]
fn inline_always() {
call_closure();
}

fn call_closure() {
let closure = || {
do_panic();
};
closure();
}

fn do_panic() {
println!("A normal log message");
panic!("OMG EVERYTHING IS ON FIRE!!!");
}
2 changes: 1 addition & 1 deletion tests/single-panic/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn debug() {
.envs(envs)
.assert()
.stderr_eq(snapbox::str![[r#"
thread 'main' panicked at tests/single-panic/src/main.rs:7:5:
thread 'main' panicked at tests/single-panic/src/main.rs:[..]:
OMG EVERYTHING IS ON FIRE!!!
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Expand Down

0 comments on commit d0d3995

Please sign in to comment.