Closed vsajip closed 5 years ago
You have to run unit_main
from dunit.framework
. There are, however, several ways to do this:
unit_main(args);
in your main
functionversion (unittest) ... else ...
to select either mixin Main;
or your own main
functiondub
"configurations" for your executable and for the test runner
(move the test-runner main
for example from source
to unittest/main.d
and specify it explicitly as "mainSourceFile")Thanks. I figured it out and used the first option.
It's probably something dumb I'm doing, so I'd appreciate any pointers - I'm fairly new to D and
dub
. Here's mydub.json
:and here's my test code:
When I run
dub test
, I get:But nothing seems to run, since no failure is printed. The
dconfig-test-library
certainly seems to contain the symbols forMyFirstTest
andshouldFail
, so why would the test not be run?The D version is
DMD64 D Compiler v2.082.0
, running on Ubuntu 16.04.By the way, your
example.d
shows amixin Main;
, but I've omitted that since it doesn't seem to be needed to bring amain
in. In fact, adding it causes a build failure due toError: only one main allowed.