[Issue 22941] New: failing unittest should omit stack trace only if assert was thrown directly by the unittest
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 26 14:22:21 UTC 2022
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 at puremagic.com
Reporter: duser at neet.fi
CC: duser at 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
--
More information about the Digitalmars-d-bugs
mailing list