Closed
Description
The following occurs when running the tests
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=35f64605807f3e34fd6a5cb1e650677c
use std::fmt::{Display, self};
struct MyStruct;
impl Display for MyStruct {
fn fmt(&self, _: &mut fmt::Formatter<'_>) -> fmt::Result {
todo!()
}
}
#[cfg(test)]
mod test {
use super::*;
#[test]
fn struct_does_stuff() {
let instance = MyStruct;
assert!(false, "oh no, '{}' was unexpected", instance);
}
}
When the tests are ran, the current output is:
Compiling playground v0.0.1 (/playground)
Finished test [unoptimized + debuginfo] target(s) in 0.84s
Running unittests src/lib.rs (target/debug/deps/playground-ab40f7b3bfdd8beb)
thread panicked while panicking. aborting.
error: test failed, to rerun pass '--lib'
After figuring out what the actual issue is, the error message makes sense. But my debugging journey would have been more pleasant, if the source location of the panics were included in the message. Much like the location of "non-nested" panics are printed.
Ideally the output should look like:
At least include the source location of the "inner" panic, or ideally both.
It also suggests to rerun pass with '--lib', which is a bit misleading.
If above is not possible, at least print the name of the test that is failing.
Metadata
Metadata
Assignees
Type
Projects
Status
Done