unittest which uses a disk file

Victor Porton porton at narod.ru
Wed Jan 16 21:30:02 UTC 2019


On Wednesday, 16 January 2019 at 21:07:24 UTC, Victor Porton 
wrote:
> What is the rule for unittest which uses a file (containing 
> example data for testing) available only in the source 
> distribution, not in binary distribution?
>
> I am writing a library.
>
> The library has also a file main.d which is compiled only in 
> DUB "application" configuration (I use this configuration 
> solely for testing.)
>
> Maybe I should put unittest { } into main.d not in the module 
> which I test?
>
> Also, what is the correct way to locate the file in the 
> filesystem?

Also if I choose to put any tests in main.d, should these tests 
be within unittest { }? main.d is anyway meant to be compiled 
only in unittest mode, so I'm unsure.


More information about the Digitalmars-d-learn mailing list