On Fri, 04 Dec 2015 19:00:37 +0000, Russel Winder via Digitalmars-d wrote: > … is completely hideous, or am I unique in objecting to the mess of > output you get on a test fail?
You are probably thinking mainly of failing assertions directly in the body of a unittest block, but assertions can happen anywhere, and uncaught exceptions can also fail a unittest. In either of these cases, I do want to see a stacktrace. The problem with stacktraces at the moment is this: core.exception.AssertError@source/url.d(925): Assertion failure ---------------- ??:? _d_assert [0x52b10f] ??:? void url.__assert(int) [0x528597] source/url.d:925 immutable(char)[] url.punyDecode(immutable(char)[]) [0x5139b0] source/url.d:989 void url.__unittestL988_12() [0x513c39] ??:? void url.__modtest() [0x528535] ??:? int core.runtime.runModuleUnitTests().__foreachbody2 (object.ModuleInfo*) [0x561c3a] ??:? int object.ModuleInfo.opApply(scope int delegate (object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*)) [0x52a8d7] ??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable (object.ModuleInfo*))).__foreachbody2(ref rt.sections_elf_shared.DSO) [0x53137a] ??:? int rt.sections_elf_shared.DSO.opApply(scope int delegate(ref rt.sections_elf_shared.DSO)) [0x531409] ??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable (object.ModuleInfo*))) [0x53130b] ??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)) [0x52a8b3] ??:? runModuleUnitTests [0x561aad] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char [][])*).runAll() [0x52da06] ??:? void rt.dmain2._d_run_main(int, char**, extern (C) int function(char [][])*).tryExec(scope void delegate()) [0x52d9b4] ??:? _d_run_main [0x52d911] ??:? main [0x50ee8f] ??:? __libc_start_main [0xcb7e2ec4] 20 lines of stacktrace. The potentially useful portion of the stacktrace: source/url.d:925 immutable(char)[] url.punyDecode(immutable(char)[]) [0x5139b0] source/url.d:989 void url.__unittestL988_12() [0x513c39] I think a good approximation would be to skip from the head of the stack to the first non-runtime frame, but, if no non-runtime frames exist, emit the whole stacktrace. That wouldn't hide anything in the case of a runtime crash, but it would eliminate about 15 lines of cruft.
