dmd -unittest=<pattern> (same syntax as -i)

Seb seb at wilzba.ch
Thu Mar 15 14:48:11 UTC 2018


On Thursday, 15 March 2018 at 12:14:12 UTC, Jacob Carlborg wrote:
> On Thursday, 15 March 2018 at 05:22:45 UTC, Seb wrote:
>
>> Hmm how would this solve the StdUnittest use case? I.e. that 
>> templated phobos unittests and private unittest symbols are 
>> compiled into the users unittests?
>>
>> See also:
>>
>> https://github.com/dlang/phobos/pull/6202
>> https://github.com/dlang/phobos/pull/6159
>
> I would hope this would be solvable without the having the user 
> do something, like `-unittest=<pattern>`.
>
> --
> /Jacob Carlborg

... exactly my point, but I think I misunderstood the goal of 
-unittest=<pattern>. It's solely about being able to filter 
selectively for which unittests to run, which is a noble goal 
itself.

A bit of background regarding StdUnittest
-----------------------------------------

To explain the need for StdUnittest to people who haven't been 
following up on the discussion have a look at 
https://github.com/dlang/phobos/pull/5927 which introduced 
StdUnittest initially.

There are a few examples in this PR:

1) short-path version(unittest) in a symbol was done in 
production code too (see 
https://github.com/dlang/phobos/pull/5932)

2) The unittest in templated aggregates are compiled and executed 
whenever the users uses the templates (see also: 
https://wiki.dlang.org/DIP82)

3) version(unitest) symbols which are added for unittest are 
still visible and compiled into user code. Of course this should 
be fixed with `private`, but even then the compiler still looks 
at the symbol, which it wouldn't do with StdUnittest (see 
Vladimir's comment about import time 
https://github.com/dlang/phobos/pull/6159#issuecomment-365290004)

Now StdUnitest was reverted because -deps compiles ALL code and 
thus lead to breakage in downstream packages, see 
https://github.com/dlang/phobos/pull/6159 for the discussion


More information about the Digitalmars-d mailing list