On Friday, 1 November 2013 at 15:32:54 UTC, Daniel Davidson wrote:
An alternative is to move the import statements in test1.d out
of the unittest block, which becomes a function, to file scope.
Then if you have multiple unittests in test1.d all are covered
and the symbols are available.
...
version(unittest) {
import methods;
}
unittest
{
import std.stdio;
writeln("test1 unit test");
S s;
assert(s.x.nothing());
}
Thanks
Dan
Ah right, if the unit tests are transformed into a function then
is this a problem with the scoped import rules? It seems really
odd, as the compiler seems to strip out the imports within the
unit test block when that module is imported into another. This
doesn't seem to affect the standard library only user modules.