D import idiom compilation time

Seb seb at wilzba.ch
Mon Jan 7 18:11:51 UTC 2019


On Sunday, 6 January 2019 at 20:26:49 UTC, FR86 wrote:
> On Sunday, 6 January 2019 at 17:36:44 UTC, Daniel N wrote:
>
>> Personally I prefer "static assert" over exceptions.
>
> Makes sense! Updated to use static assert outside of unittests.

`version(unittest)` will also be defined if a user uses your 
library for testing his code. If you really want to, you could 
set a special version via dub, e.g.:

```
configuration "unittest" {
     version "LocalImportUnittest"
}
```

Also, you need to e.g. split up your test into two as otherwise 
you won't test whether the first part of the test (or the second 
for that matter) actually throws. You are currently doing an XOR 
in both parts.


More information about the Digitalmars-d mailing list