digitalmars.D.bugs - [Issue 22941] New: failing unittest should omit stack trace only if
- d-bugmail puremagic.com (34/34) Mar 26 2022 https://issues.dlang.org/show_bug.cgi?id=22941
https://issues.dlang.org/show_bug.cgi?id=22941 Issue ID: 22941 Summary: failing unittest should omit stack trace only if assert was thrown directly by the unittest Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: duser neet.fi CC: duser neet.fi see todo comment: https://github.com/dlang/druntime/blob/v2.099.0/src/core/runtime.d#L614-L617 // Exception originates in the same module, don't print // the stack trace. // TODO: omit stack trace only if assert was thrown // directly by the unittest. added in https://github.com/dlang/druntime/pull/2611 before that PR, failing unittests would always print a stack trace - now, the stack trace is omitted for all asserts originating from the same module // test.d // run with: dmd -main -unittest -run test.d void fn() { assert(0, "oh no"); } unittest { fn(); } current output: test.d(1): [unittest] oh no 1/1 modules FAILED unittests this example should print the stack trace since the assert() wasn't in the unittest block itself --
Mar 26 2022