-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dub test with betterC #1636
Comments
That's kind of expected as
This way |
unittests does work in dub should be able to generate a different dub_test_root for betterC builds |
I just stumbled on this. |
I would also like |
As far as I can tell one reason 'dub test' not to work with 'betterC' option is that some code which dub emits to execute the unit tests uses 'writeln' which seems to be unsupported in 'betterC'. I'll post a PR with a fix for this problem and we'll see how it goes. |
This change modifies dub.d so to emit different code to execute unittests if 'betterC' option is used. The difference is that the code emitted for 'betterC' uses 'printf' instead of 'writeln'. This change also includes a simple test which verifies that 'dub test' works with 'betterC'.
This change modifies dub.d so to emit different code to execute unittests if 'betterC' option is used. The difference is that the code emitted for 'betterC' uses 'printf' instead of 'writeln'. This change also includes a simple test which verifies that 'dub test' works with 'betterC'.
This change modifies dub.d to emit different code to execute unittests if 'betterC' option is used. The difference is that the code emitted for 'betterC' uses 'printf' instead of 'writeln'. This change also includes a simple test which verifies that 'dub test' works with 'betterC'.
Just realised that fixing the 'writeln' issue won't resolve this problem because tests are executed in module's shared static constructor which will not be executed in betterC. I'll try to come up with a complete fix and will post it once I'm ready. |
Could generate a main that calls the unit tests using compile-time introspection int main(string[] args) {
foreach (unitTest; __traits(getUnitTests, thismodule)) {
unitTest();
}
return remappedMain(args);
}
int remappedMain(string[] args) {
// Dub test builder would treat the program's regular main as this when built using test mode.
} The only difficulty I can see with this solution is collecting the names of every module that needs to be tested, as well as generating the entry point. |
seems like this is still an issue |
We already have this implemented in the generated test module: dub_test_root. Line 292 in 82d7a90
|
Bug Description
dub test
doesn't work whenbetterC
is inbuildOptions
The text was updated successfully, but these errors were encountered: