Fix tests (these seem very brittle)

This commit is contained in:
Aode (lion) 2021-12-26 11:49:29 -06:00
parent 088ed536c3
commit d8f8657886
3 changed files with 45 additions and 43 deletions

View File

@ -34,7 +34,7 @@ fn main() {
let span = tracing::info_span!("get_error", msg);
let _guard = span.enter();
let error = get_error(msg);
panic!(error)
std::panic::panic_any(error)
}
fn setup() {

View File

@ -2,49 +2,49 @@
0: test
Location:
tests/theme.rs:1
tests/theme.rs:17
Error:
0: error
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0: theme::get_error with msg="test"
0: theme::get_error with msg="test"
at tests/theme.rs:11
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ⋮ 5 frames hidden ⋮ 
6: theme::get_error::create_report::h982c27931cc8e4b1
at <unknown source file>:<unknown line>
7: theme::get_error::{{closure}}::hae775e99e0b7d1c5
at <unknown source file>:<unknown line>
8: core::option::Option<T>::ok_or_else::hd4b57a8cb5c1870b
at /home/jlusby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:558
9: theme::get_error::hfc71373d92f563f0
at /home/jlusby/git/yaahc/color-eyre/tests/theme.rs:1
10: theme::test_error_backwards_compatibility::h4bf087e5e689a5d0
at /home/jlusby/git/yaahc/color-eyre/tests/theme.rs:36
11: theme::test_error_backwards_compatibility::{{closure}}::hf172868901d86cb0
at /home/jlusby/git/yaahc/color-eyre/tests/theme.rs:34
12: core::ops::function::FnOnce::call_once::h9b87751ef643fe90
at /home/jlusby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
13: core::ops::function::FnOnce::call_once::hb2ff33e91aac5799
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/core/src/ops/function.rs:227
14: test::__rust_begin_short_backtrace::hc8fd71b19bc78390
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/test/src/lib.rs:516
15: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hb8ab4b7e0de41b66
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/alloc/src/boxed.rs:1042
16: <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hc48829c2ba8b55d6
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panic.rs:308
17: std::panicking::try::do_call::h95feedb4d9e8dd5b
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:381
18: std::panicking::try::hc4c23f5f7d3bdd43
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panicking.rs:345
19: std::panic::catch_unwind::hf3a57d903cc5007a
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/std/src/panic.rs:382
20: test::run_test_in_process::h09c598ed2a1f6695
at /rustc/7eac88abb2e57e752f3302f02be5f3ce3d7adfb4/library/test/src/lib.rs:543
 ⋮ 14 frames hidden ⋮ 
6: theme::get_error::create_report::hd9d97e4e76dee44c
at /home/asonix/Development/rust/color-eyre/tests/theme.rs:17
7: theme::get_error::{{closure}}::h4cc7ce7893f295cb
at /home/asonix/Development/rust/color-eyre/tests/theme.rs:25
8: core::option::Option<T>::ok_or_else::hc00ef515ea43ef82
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/option.rs:954
9: theme::get_error::haf4b483cac8d076b
at /home/asonix/Development/rust/color-eyre/tests/theme.rs:25
10: theme::test_error_backwards_compatibility::hf4c9eaf012b11366
at /home/asonix/Development/rust/color-eyre/tests/theme.rs:43
11: theme::test_error_backwards_compatibility::{{closure}}::h972249b6ebd599cb
at /home/asonix/Development/rust/color-eyre/tests/theme.rs:41
12: core::ops::function::FnOnce::call_once::h8855848bc65b81ec
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227
13: core::ops::function::FnOnce::call_once::h83cc023b85256d97
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227
14: test::__rust_begin_short_backtrace::h7330e4e8b0549e26
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/test/src/lib.rs:585
15: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h6b77566b8f386abb
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/alloc/src/boxed.rs:1691
16: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::h2ad5de64df41b71c
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/panic/unwind_safe.rs:271
17: std::panicking::try::do_call::he67b1e56b423a618
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:403
18: std::panicking::try::ha9224adcdd41a723
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panicking.rs:367
19: std::panic::catch_unwind::h9111b58ae0b27828
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panic.rs:133
20: test::run_test_in_process::h15b6b7d5919893aa
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/test/src/lib.rs:608
 ⋮ 15 frames hidden ⋮ 
Note: note
Warning: warning

View File

@ -1,21 +1,23 @@
Finished dev [unoptimized + debuginfo] target(s) in 0.03s
Finished dev [unoptimized + debuginfo] target(s) in 0.02s
Running `target/debug/examples/theme_test_helper`
The application panicked (crashed).
Message: <non string panic payload>
Location: examples/theme_test_helper.rs:37
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
0: theme_test_helper::get_error with msg="test"
0: theme_test_helper::get_error with msg="test"
at examples/theme_test_helper.rs:34
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
 ⋮ 6 frames hidden ⋮ 
7: theme_test_helper::main::h0f7f307e00efc098
at /home/jlusby/git/yaahc/color-eyre/examples/theme_test_helper.rs:37
8: core::ops::function::FnOnce::call_once::hc90fd75bf8c9f979
at /home/jlusby/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227
 ⋮ 11 frames hidden ⋮ 
7: std::panic::panic_any::hdb02375f91faf2b1
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/std/src/panic.rs:57
8: theme_test_helper::main::hc643d5b602546a09
at /home/asonix/Development/rust/color-eyre/examples/theme_test_helper.rs:37
9: core::ops::function::FnOnce::call_once::hb05b32a2aa2386ee
at /rustc/f1edd0429582dd29cccacaf50fd134b05593bd9c/library/core/src/ops/function.rs:227
 ⋮ 15 frames hidden ⋮ 
Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.