d
d copied to clipboard
Dub Test gives Crazy Output
Hello!
I just installed d and dub based on the install guide. When I run dub test
though this is the output:
hello-world (master) ⚾ dub test
Generating test runner configuration 'hello-world-test-library' for 'library' (library).
Performing "unittest" build using dmd for x86_64.
hello-world ~master: building configuration "hello-world-test-library"...
Linking...
Running ./hello-world-test-library
source/hello_world.d(10): [unittest] unittest failure
core.exception.AssertError@source/hello_world.d(10): unittest failure
----------------
??:? _d_unittestp [0x10e72047d]
/var/folders/jk/1yhv_4k52pg2y98xs_ct0dh80000gn/T/dub_test_root_5ffdaf2f_f090_4185_b42a_c86fbcc8b8b3.d:19 void hello_world.__unittest_L8_C1() [0x10e7133c7]
/var/folders/jk/1yhv_4k52pg2y98xs_ct0dh80000gn/T/dub_test_root_5ffdaf2f_f090_4185_b42a_c86fbcc8b8b3.d:9 void hello_world.__modtest() [0x10e712ce8]
??:? int core.runtime.runModuleUnitTests().__foreachbody2(object.ModuleInfo*) [0x10e7210bc]
??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*)) [0x10e71602b]
??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref rt.sections_osx_x86_64.SectionGroup) [0x10e74198f]
??:? int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))) [0x10e74191c]
??:? int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)) [0x10e715ffd]
??:? runModuleUnitTests [0x10e720ee6]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).runAll() [0x10e73a0c8]
??:? void rt.dmain2._d_run_main2(char[][], ulong, extern (C) int function(char[][])*).tryExec(scope void delegate()) [0x10e73a054]
??:? _d_run_main2 [0x10e739fb7]
??:? _d_run_main [0x10e739d65]
/var/folders/jk/1yhv_4k52pg2y98xs_ct0dh80000gn/T/dub_test_root_5ffdaf2f_f090_4185_b42a_c86fbcc8b8b3.d:9 main [0x10e712cc9]
??:? start [0x7fff64d497fc]
??:? 0x0 [0x0]
1/1 unittests FAILED
Program exited with code 1
Is this what's supposed to happen? Shouldn't I get some output message saying that it's expecting to get the string "Hello, World!" but it got something else?
Thanks! 🙏
The unit test for the D track are using the build in unittest
from the D core library. https://dlang.org/spec/unittest.html
What you are seeing from the output is what you should be seeing, sadly. I find the unittest
very lacking as they only really do assert
for true and false and will not output any details. A bit ago I did take look to see if there was anything better we could use that would be more user friendly but I was unable to find anything that was kept up to date.
If I have sometime today I'll take another look around. As D is not my primary language, any suggestion would be great!
Thanks @amscotti!
I have never coded in D before trying to do these exercises. I can't really offer any suggestions bc I don't know of any other D testing tools, but from my experiences unit testing in other languages I can say it's definitely nice when the test runner gives you very specific feedback! 😊