How can one reliably run unittests
deadalnix
deadalnix at gmail.com
Thu Sep 2 23:22:57 UTC 2021
On Thursday, 2 September 2021 at 23:00:06 UTC, Steven
Schveighoffer wrote:
> When you use -i, it means *ALL MODULES AND IMPORTS* are built
> with the -unittest flag, and so they all run.
>
I know. That's dumb.
> -i is going to run all unittests. How else would it interpret
> the command line? If you want to build some modules differently
> than others
> (i.e. some with unittests and some without), you can't use -i.
>
Is this groundhog day? There are no combination of flags that do
the sensible thing. I can't use -i, no problem. I can't use
anything else either, big problem.
The proof is in the pudding, you just told me that I need a full
build infra to run unittests for something that use anything else
than phobos.
> What is the "right thing"? Reading what you expect in your mind
> is not what a compiler can do. Define how it will work. I think
> unittests work acceptably the way they are now, but I'm sure
> others would be keen to have some more bells and whistles. Just
> make a proposal and get it merged in.
>
The right thing is being able to run the unitests of a god damn
module easily. not the unit tests of that module and all of its
dependencies. Not using a complex test framework. Just running
the unit tests of a module.
This is the sensible thing. This is the simplest thing. This is
the "right thing".
It doesn't matter if the module has a main or not. It doesn't
matter if the module depends on phobos or half the solar system.
> Start by saying "when I type `dmd -m64 -Isrc -w -debug -g -main
> -unittest -i -run src/somemodule.d`, here is what I expect to
> happen: ...", and then define rules that will make that happen.
>
Here is what I expect.
$ dmd --run-the-god-damn-unittest mymodule.d
And it run the unit tests of mymodule.d . Replace
`--run-the-god-damn-unittest` by any set of flags that pleases
you, for as long as there is one.
More information about the Digitalmars-d
mailing list