Name

moonunit-stub — Generates MoonUnit test loading stubs

Synopsis

moonunit [-o file] [name=value...] sources...

Description

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.

Rationale

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.

Options

moonunit-stub expects one or more C or C++ source files to be specified as arguments.

In addition, the following options are available:

-o file

Write the generated stub to file. By default, the stub is written to stdout.

-h, --help

List brief usage and option information and exit.

name=value

Sets 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.

Environment

CPP

The C preprocessor which will be invoked to process C source files before scanning for unit tests. Defaults to cpp.

CXXCPP

The C++ preprocessor which will be invoked to process C++ source files before scanning for unit tests. Defaults to cpp.

CPPFLAGS

Additional arguments which will be passed to the C preprocessor.

CXXCPPFLAGS

Additional arguments which will be passed to the C++ preprocessor. Defaults to the value of CPPFLAGS.

Examples

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.

Copyright

Copyright (c) 2007-2008, Brian Koropoff. All rights reserved.

Redistribution in source and binary form is permitted under the terms of the 3-clause BSD license. See COPYING in the documentation or source distribution for details.

See also

moonunit-lt(1), moonunit(1), moonunit-strip(1)