How can one reliably run unittests
deadalnix
deadalnix at gmail.com
Fri Sep 3 08:39:35 UTC 2021
On Friday, 3 September 2021 at 03:06:27 UTC, H. S. Teoh wrote:
>> 2/ the `-main` problem remains.
>
> Even though it's kinda related, -main is really an orthogonal
> issue. I've also run into the problem myself where -main is
> needed when your modules don't contain main() but must be
> suppressed or worked around when it does declare main(). This
> should be fixed so that -main *optionally* inserts an empty
> main(), e.g., as a weak symbol, or whatever, so that the
> existence of a real main() doesn't cause a linker error.
>
>
Well, yes and no. It can be solved in an orthogonal fashion, but
this really is the same problem: the flag you can pass to the
compiler are doing nonsensical stuff and are not amendable to
common use cases.
>> 3/ it still isn't possible to run the unit tests of several
>> modules in one go by passing a list of modules to the compiler
>> (in the same way you can compile several modules in one go and
>> generate an object file for all of them at once).
>
> Of course you can. Under my proposal:
>
> dmd -unittest=module -i -run mod1.d mod2.d mod3.d main.d
>
No, this will run the code in mod1.d , passing ["mod2.d" "mod3.d"
"main.d"] as command line arguments.
More information about the Digitalmars-d
mailing list