I ran the example.d, the output style of tests are something I would like to use for my code. However, reading example.d content, it is not clear to me what is the real code and what is the test code. And more practically, how do I migrate from the code using D built-in unittest to dunit.
For example, consider myDbuiltinTest.d:
import std.string: toLower;
string strToLower(string s){
string ret;
foreach(c; s) ret ~= toLower(c);
return ret;
}
unittest{
writeln("Test strToLower);
assert("lower" == strToLower("LoWer"));
}
unittest{
writeln("Test strToLower with unicode);
assert(" lower2 ü" == strToLower(" LoWer2 Å"));
}
My questions:
- How do I make use of
dunit in this case?
- And in case I want to run a particular test because hundreds of other tests have just been run, how do I do that?
- Finally when I want to run test for the whole project with multiple files, do I have to walk through all
.d files and execute them individually?
I ran the example.d, the output style of tests are something I would like to use for my code. However, reading example.d content, it is not clear to me what is the real code and what is the test code. And more practically, how do I migrate from the code using D built-in unittest to
dunit.For example, consider myDbuiltinTest.d:
My questions:
dunitin this case?.dfiles and execute them individually?