diff --git a/source/dub/project.d b/source/dub/project.d index c8a35f9..4ae164f 100644 --- a/source/dub/project.d +++ b/source/dub/project.d @@ -345,20 +345,25 @@ fil.write(format("import %s;\n", custommodname)); } else { fil.write(q{ - import std.stdio; - import core.runtime; +import core.runtime; - void main() { 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."); + } +} + }); } } diff --git a/test/cov-ctfe.sh b/test/cov-ctfe.sh index 1233112..5b733c4 100755 --- a/test/cov-ctfe.sh +++ b/test/cov-ctfe.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash DIR=$(dirname "${BASH_SOURCE[0]}") - . "$DIR"/common.sh - -DFLAGS='-cov=100' "$DUB" run --root "$DIR"/cov-ctfe --build=cov-ctfe +"$DUB" run --root "$DIR"/cov-ctfe --build=cov-ctfe diff --git a/test/cov-ctfe/.no_build b/test/cov-ctfe/.no_build new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/cov-ctfe/.no_build diff --git a/test/cov-ctfe/.no_run b/test/cov-ctfe/.no_run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/cov-ctfe/.no_run diff --git a/test/cov-ctfe/.no_test b/test/cov-ctfe/.no_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/cov-ctfe/.no_test diff --git a/test/cov-ctfe/dub.sdl b/test/cov-ctfe/dub.sdl index bb1ba3f..51da666 100644 --- a/test/cov-ctfe/dub.sdl +++ b/test/cov-ctfe/dub.sdl @@ -1,4 +1,5 @@ name "test" version "1.0.0" targetType "executable" -sourceFiles "test.d" +dflags "-cov=100" +mainSourceFile "test.d" diff --git a/test/unittest-cov-ctfe.sh b/test/unittest-cov-ctfe.sh index 9fd7f55..a97a262 100755 --- a/test/unittest-cov-ctfe.sh +++ b/test/unittest-cov-ctfe.sh @@ -1,7 +1,5 @@ #!/usr/bin/env bash DIR=$(dirname "${BASH_SOURCE[0]}") - . "$DIR"/common.sh - -DFLAGS='-cov=100' "$DUB" test --root "$DIR"/unittest-cov-ctfe --build=unittest-cov-ctfe +"$DUB" test --root "$DIR"/unittest-cov-ctfe --build=unittest-cov-ctfe diff --git a/test/unittest-cov-ctfe/.no_build b/test/unittest-cov-ctfe/.no_build new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/unittest-cov-ctfe/.no_build diff --git a/test/unittest-cov-ctfe/.no_run b/test/unittest-cov-ctfe/.no_run new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/unittest-cov-ctfe/.no_run diff --git a/test/unittest-cov-ctfe/.no_test b/test/unittest-cov-ctfe/.no_test new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/unittest-cov-ctfe/.no_test diff --git a/test/unittest-cov-ctfe/dub.sdl b/test/unittest-cov-ctfe/dub.sdl index 660c022..de485d0 100644 --- a/test/unittest-cov-ctfe/dub.sdl +++ b/test/unittest-cov-ctfe/dub.sdl @@ -1,3 +1,4 @@ name "test" version "1.0.0" targetType "library" +dflags "-cov=100"