为什么单元测试适用于程序1,但不适用于下面的程序2?
计划1
import std.stdio;
unittest
{
assert(false);
}
void main()
{
writeln("Hello D-World!");
}
Run Code Online (Sandbox Code Playgroud)
计划2
module winmain;
import core.sys.windows.windows;
unittest {
assert(false);
}
extern (Windows)
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow)
{
return 0;
}
Run Code Online (Sandbox Code Playgroud)
两个程序都使用-unittest选项编译(通过运行dmd -unittest <program.d>).运行时,程序1显示单元测试失败,但程序2不显示.我错过了什么?
更新:重新制定的问题和增加的工作实例.
更新2:也编译dmd -debug -unittest <program.d>,具有类似的结果.