[BUG] failed unittest in renamed module prints stack trace
kdevel
kdevel at vogtner.de
Fri May 23 06:42:02 UTC 2025
If this Program
```d
module foo_bar;
unittest {
assert (1 == 2);
}
```
is stored under the name `foo_bar.d` one gets what is expected:
```
$ dmd -checkaction=context -unittest -main -run foo_bar.d
foo_bar.d(4): [unittest] 1 != 2
1/1 modules FAILED unittests
```
However, if the module name differs from the filename [1] an
additional core dump is generated:
```
dmd -checkaction=context -unittest -main -run foo-bar.d
core.exception.AssertError at foo-bar.d(4): 1 != 2
----------------
??:? _d_unittest_msg [0x445158]
??:? void foo_bar.__unittest_L3_C1() [0x43cb14]
??:? void foo_bar.__modtest() [0x43d924]
??:? int
core.runtime.runModuleUnitTests().__foreachbody_L600_C5(object.ModuleInfo*) [0x44e8e6]
??:? int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*)).__lambda_L2459_C13(immutable(object.ModuleInfo*)) [0x44bd1b]
??:? int rt.minfo.moduleinfos_apply(scope int
delegate(immutable(object.ModuleInfo*))).__foreachbody_L584_C5(ref rt.sections_elf_shared.DSO) [0x4549ab]
??:? int rt.sections_elf_shared.DSO.opApply(scope int
delegate(ref rt.sections_elf_shared.DSO)) [0x454e7d]
??:? int rt.minfo.moduleinfos_apply(scope int
delegate(immutable(object.ModuleInfo*))) [0x454939]
??:? int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*)) [0x44bced]
??:? runModuleUnitTests [0x44e71b]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int
function(char[][])*).runAll() [0x447134]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int
function(char[][])*).tryExec(scope void delegate()) [0x4470c1]
??:? _d_run_main2 [0x44702a]
??:? _d_run_main [0x446e13]
??:? main [0x43d93b]
??:? __libc_start_main [0x7ffff700e585]
../sysdeps/x86_64/elf/start.S:113 [0x43c9f8]
1/1 modules FAILED unittests
```
[1] https://dlang.org/spec/module.html#module_declaration
More information about the Digitalmars-d
mailing list