unit_threaded.runtime

This module implements a template mixin containing a program to search a list of directories for all .d files therein, then writes a D program to run all unit tests in those files using unit_threaded. The program implemented by this mixin only writes out a D file that itself must be compiled and run.

To use this as a runnable program, simply mix in and compile:

#!/usr/bin/rdmd
import unit_threaded;
mixin genUtMain;

Generally however, this code will be used by the gen_ut_main dub configuration via dub run.

By default, genUtMain will look for unit tests in CWD and write a program out to a temporary file. To change the file to write to, use the -f option. To change what directories to look in, simply pass them in as the remaining command-line arguments.

The resulting file is also a program that must be compiled and, when run, will run the unit tests found. By default, it will run all tests. To run one test or all tests in a particular package, pass them in as command-line arguments. The -h option will list all command-line options.

Examples (assuming the generated file is called ut.d):

rdmd -unittest ut.d # run all tests
rdmd -unittest ut.d tests.foo tests.bar # run all tests from these packages
rdmd ut.d -h # list command-line options

Meta