main.d:
-------------------
import std.stdio;
shared static this()
{
import vibe.core.log;
setLogLevel(LogLevel.trace);
logDebug("log: statc this");
WRITELN("WRiteln: static this");
}
void main()
{
writeln("Edit source/app.d to start your project.");
}
test.d:
-------------------
import std.stdio;
unittest
{
import vibe.core.log;
logDebug("log: unittest");
writeln("writeln: unittest");
}
Running `dub test` will output:
Running ./unit-test-library
writeln: unittest
All unit tests have been run successfully.
Why is the `shared static this()` not executed?
Shared static this() not executed for unittest
Timoses via Digitalmars-d-learn Sat, 15 Dec 2018 09:20:30 -0800
Spec 27.5 states: "Unit tests, when enabled, are run after all
static initialization is complete and before the main() function
is called. " (https://dlang.org/spec/unittest.html)
- Shared static this() not exec... Timoses via Digitalmars-d-learn
- Re: Shared static this()... Neia Neutuladh via Digitalmars-d-learn
- Re: Shared static th... Jonathan M Davis via Digitalmars-d-learn
- Re: Shared static th... Steven Schveighoffer via Digitalmars-d-learn
- Re: Shared stati... Jonathan M Davis via Digitalmars-d-learn
- Re: Shared static this()... Timoses via Digitalmars-d-learn
