digitalmars.D.learn - unittests and imported modules
- kdevel (15/15) Jan 28 2021 Today I moved some functions to a new module within the same
- H. S. Teoh (12/20) Jan 28 2021 Which version of dmd is this? In the latest releases, this inaccurate
- kdevel (11/20) Jan 28 2021 $ dmd --version
- H. S. Teoh (13/19) Jan 28 2021 To answer your other question:
Today I moved some functions to a new module within the same package and ran dmd -g -i -unittest -checkaction=context -main -run <filename>. dmd reported 5 unittests passed I would have expected that only the one unittest in <filename> would have been compiled. After inserting print statements into the other modules I found that the additional four unittests originate from the imported files. Is there a trick to get only the unittest from <filename> run other than dropping the "-i" and specifiying the other object files on the command line? And why are the unittests from the imported phobos functions not run?
Jan 28 2021
On Thu, Jan 28, 2021 at 07:44:59PM +0000, kdevel via Digitalmars-d-learn wrote:Today I moved some functions to a new module within the same package and ran dmd -g -i -unittest -checkaction=context -main -run <filename>. dmd reported 5 unittests passedWhich version of dmd is this? In the latest releases, this inaccurate message has been replaced with: 5 modules passed unittests The count displayed is not the number of unittests, but the number of *modules* that passed unittests. I've no idea why the original message was worded in such a misleading way, but it should have been fixed by now. T -- Why did the mathematician reinvent the square wheel? Because he wanted to drive smoothly over an inverted catenary road.
Jan 28 2021
On Thursday, 28 January 2021 at 20:03:34 UTC, H. S. Teoh wrote: [...]$ dmd --version DMD64 D Compiler v2.093.1 Copyright (C) 1999-2020 by The D Language Foundation, All Rights Reserved written by Walter Bright5 unittests passedWhich version of dmd is this?In the latest releases, this inaccurate message has been replaced with: 5 modules passed unittests The count displayed is not the number of unittests, but the number of *modules* that passed unittests. I've no idea why the original message was worded in such a misleading way, but it should have been fixed by now.DMD Versions > v2.094.1 expose a library issue here on my machine such that I can only run the 32-Bit version of the compiler (which nonetheless produces working 64-Bit-Code).
Jan 28 2021
To answer your other question: On Thu, Jan 28, 2021 at 07:44:59PM +0000, kdevel via Digitalmars-d-learn wrote: [...]After inserting print statements into the other modules I found that the additional four unittests originate from the imported files. Is there a trick to get only the unittest from <filename> run other than dropping the "-i" and specifiying the other object files on the command line?AFAIK it's currently not possible with the built-in test runner. But there are dub packages for replacement test runners that may offer this functionality.And why are the unittests from the imported phobos functions not run?Phobos was hacked to only run unittests when StdUnittest is defined. It's a workaround for the lameness that unittests from *all* imported modules are run with a -unittest build, including from external modules and libraries you may not be concerned with. T -- The easy way is the wrong way, and the hard way is the stupid way. Pick one.
Jan 28 2021