Skip to content

Commit

Permalink
Add betterC support - fixes dlang#1636
Browse files Browse the repository at this point in the history
  • Loading branch information
Etienne Cimon committed Feb 8, 2023
1 parent 5f756ca commit e5818ba
Showing 1 changed file with 28 additions and 17 deletions.
45 changes: 28 additions & 17 deletions source/dub/project.d
Original file line number Diff line number Diff line change
Expand Up @@ -1916,22 +1916,33 @@ alias allModules = TypeTuple!(

/// The default test runner that gets used if none is provided
private immutable DefaultTestRunnerCode = q{
import core.runtime;

void main() {
version (D_Coverage) {
version(D_BetterC) {
extern(C) int main() {
foreach (module_; allModules) {
foreach (unitTest; __traits(getUnitTests, module_)) {
unitTest();
}
}
import core.stdc.stdio : puts;
puts("All unit tests have been run successfully.");
return 0;
}
} else {
import std.stdio : writeln;
writeln("All unit tests have been run successfully.");
}
}
shared static this() {
version (Have_tested) {
import tested;
import core.runtime;
import std.exception;
Runtime.moduleUnitTester = () => true;
enforce(runUnitTests!allModules(new ConsoleTestResultWriter), "Unit tests failed.");
void main() {
version (D_Coverage) {
} else {
import std.stdio : writeln;
writeln("All unit tests have been run successfully.");
}
}
shared static this() {
version (Have_tested) {
import tested;
import core.runtime;
import std.exception;
Runtime.moduleUnitTester = () => true;
enforce(runUnitTests!allModules(new ConsoleTestResultWriter), "Unit tests failed.");
}
}
}
}
};
};

0 comments on commit e5818ba

Please sign in to comment.