On 3/26/18 9:26 AM, Atila Neves wrote:
On Friday, 23 March 2018 at 14:54:57 UTC, Steven Schveighoffer wrote:
On 3/22/18 6:59 AM, Atila Neves wrote:
Blog post:
https://atilanevesoncode.wordpress.com/
Atila
It's simple. Unittests in imported modules should not be visible. They
should be compiled as if -unittest was not passed.
Even Walter and Andrei are supportive:
https://github.com/dlang/dmd/pull/6375#issuecomment-373487247
That would completely break __traits(getUnitTests).
I'm sure we could find a way to keep the features here, 99.99% of the
time, you don't care about, nor want to parse or semantic, an imported
module's unit tests. Only specialized unit test frameworks care about
this feature.
It could be as simple as, if you use __traits(getUnitTests, modulename)
anywhere in a module, then that module is imported the traditional way.
Or we could create a specialized "import unittest" syntax for this purpose.
I think we can have the best of both worlds, with the common case being
preferred.
-Steve