moonunit-stub scans C and C++ source files for MoonUnit unit tests and generates a C stub file which assists the default test loader. Scanned files are first processed by the C or C++ preprocessor.
The default MoonUnit test loader can use symbol information read from dynamic libraries to locate and access all unit tests. This symbol scanning process allows for convenient, rapid prototyping, but works only on some platforms.
By scanning the source code for unit tests prior to compilation, moonunit-stub allows unit test modules to be loadable on all supported platforms.
moonunit-stub expects one or more C or C++ source files to be specified as arguments.
In addition, the following options are available:
-o fileWrite the generated stub to file.
By default, the stub is written to stdout.
-h, --helpList brief usage and option information and exit.
name=valueSets an environment variable for the duration of this
scrpt. This provides a convenient shorthand for
setting variables such as CPPFLAGS.
See the section called “Environment” for more details.
CPPThe C preprocessor which will be invoked to process C source files before scanning for unit tests. Defaults to cpp.
CXXCPPThe C++ preprocessor which will be invoked to process C++ source files before scanning for unit tests. Defaults to cpp.
CPPFLAGSAdditional arguments which will be passed to the C preprocessor.
CXXCPPFLAGSAdditional arguments which will be passed to the C++ preprocessor. Defaults to the value of CPPFLAGS.
moonunit-stub foo.c bar.c
Scan foo.c and bar.c for unit
tests and write the resulting stub to stdout.
moonunit-stub -o stub.c bob.c CPP="gcc -E"
Scan bob.c for tests and write the resulting stub to
stub.c; invokes gcc -E to preprocess
source files.