Better unittest failure output
Bahman Movaqar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Sep 7 04:57:23 PDT 2015
I am working on a simple project created with DUB[1].
When unit tests the output reads really cryptic to me; for
example:
$ dub test
Generating test runner configuration '__test__library__' for
'library' (library).
Target dunit 1.0.11 is up to date. Use --force to rebuild.
Building d-etudes ~master configuration "__test__library__",
build type unittest.
Compiling using dmd...
Linking...
Running ./__test__library__
core.exception.AssertError at source/e002.d(111): unittest
failure
----------------
./__test__library__(void
detudes.e002.__unittest_fail(int)+0x28) [0x4bf508]
./__test__library__(void
detudes.e002.__unittestL106_4()+0x17b) [0x4bf47b]
./__test__library__(void detudes.e002.__modtest()+0xe)
[0x4bf48e]
./__test__library__(int
core.runtime.runModuleUnitTests().__foreachbody2(object.ModuleInfo*)+0x34) [0x4d0d0c]
./__test__library__(int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*))+0x1c) [0x4c1ab4]
./__test__library__(int rt.minfo.moduleinfos_apply(scope int
delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref
rt.sections_elf_shared.DSO)+0x46) [0x4c7422]
./__test__library__(int
rt.sections_elf_shared.DSO.opApply(scope int delegate(ref
rt.sections_elf_shared.DSO))+0x41) [0x4c7499]
./__test__library__(int rt.minfo.moduleinfos_apply(scope int
delegate(immutable(object.ModuleInfo*)))+0x20) [0x4c73bc]
./__test__library__(int object.ModuleInfo.opApply(scope int
delegate(object.ModuleInfo*))+0x20) [0x4c1a90]
./__test__library__(runModuleUnitTests+0x98) [0x4d0bd8]
./__test__library__(void rt.dmain2._d_run_main(int, char**,
extern (C) int function(char[][])*).runAll()+0x17) [0x4c4147]
./__test__library__(void rt.dmain2._d_run_main(int, char**,
extern (C) int function(char[][])*).tryExec(scope void
delegate())+0x2a) [0x4c40fa]
./__test__library__(_d_run_main+0x1d2) [0x4c407a]
./__test__library__(main+0x20) [0x48a968]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)
[0x7f1f751d9ec5]
Error executing command test:
Program exited with code 1
It is almost impossible for me to comprehend anything useful out
of this, except that, well, the tests have failed :-)
Is there any compiler switch, argument to `assert` or trick to
make `unittest` output more helpful messages when failing?
[1] https://github.com/bahmanm/d-etudes
More information about the Digitalmars-d-learn
mailing list