version(unittest) in imported modules

Peter Alexander peter.alexander.au at gmail.com
Sun Mar 2 11:37:45 PST 2014


On Sunday, 2 March 2014 at 18:36:16 UTC, Dicebot wrote:
> On Sunday, 2 March 2014 at 18:07:11 UTC, Peter Alexander wrote:
>> dmd -unittest foo.d
>>
>> Then version(unittest) blocks will be run inside modules that 
>> `foo` imports, even though the unittests for those modules 
>> will not run.
>>
>> Two questions:
>>
>> 1. Is this a bug?
>>
>> 2. If not, how can I tell if unittests are running in *this* 
>> module?
>
> Works as intended I say. With `rdmd -unittest foo.d` all test 
> from imported modules will be run, it just happens that raw dmd 
> does not compile imports automatically. So your second question 
> does not really make sense - all tests are always run 
> everywhere.

Tests on imported modules are not always run otherwise everyone 
would be constantly running phobos tests. rdmd is special in that 
automatically compiles imports.


More information about the Digitalmars-d mailing list