ctestdouble_opt
static
auto ctestdouble_opt =
Tuple!(string, "usage", string, "optional", string, "others")("usage:
dextool ctestdouble [options] [--in=] [-- CFLAGS]", " --main=name Used as part of interface, namespace etc [default: TestDouble]
--main-fname=n Used as part of filename for generated files [default: test_double]
--prefix=p Prefix used when generating test artifacts [default: Test_]
--strip-incl=r A regexp used to strip the include paths
--gmock Generate a gmock implementation of test double interface
--gen-pre-incl Generate a pre include header file if it doesn't exist and use it
--gen-post-incl Generate a post include header file if it doesn't exist and use it
--loc-as-comment Generate a comment containing the location the symbol was derived from.
Makes it easier to correctly define excludes/includes
--header=s Prepend generated files with the string
--header-file=f Prepend generated files with the header read from the file
--no-zeroglobals Turn off generation of the default implementation that zeroes globals
--config=path Use configuration file", "others:
--in= Input file to parse
--out=dir directory for generated files [default: ./]
--compile-db= Retrieve compilation parameters from the file
--file-exclude= Exclude files from generation matching the regex
--file-include= Restrict the scope of the test double to those files
matching the regex
--td-include= User supplied includes used instead of those found
REGEX
The regex syntax is found at http://dlang.org/phobos/std_regex.html
Information about --strip-incl.
Default regexp is: .*/(.*)
To allow the user to selectively extract parts of the include path dextool
applies the regex and then concatenates all the matcher groups found. It is
turned into the replacement include path.
Important to remember then is that this approach requires that at least one
matcher group exists.
Information about --file-exclude.
The regex must fully match the filename the AST node is located in.
If it matches all data from the file is excluded from the generated code.
Information about --file-include.
The regex must fully match the filename the AST node is located in.
Only symbols from files matching the include affect the generated test double.
EXAMPLES
Generate a simple C test double.
dextool ctestdouble functions.h
Analyze and generate a test double for function prototypes and extern variables.
Both those found in functions.h and outside, aka via includes.
The test double is written to ./test_double.hpp/.cpp.
The name of the interface is Test_Double.
Generate a C test double excluding data from specified files.
dextool ctestdouble --file-exclude=/foo.h --file-exclude='functions.[h,c]' --out=outdata/ functions.h -- -DBAR -I/some/path
The code analyzer (Clang) will be passed the compiler flags -DBAR and -I/some/path.
During generation declarations found in foo.h or functions.h will be excluded.
The file holding the test double is written to directory outdata.
");
dextool plugin ctestdouble frontend ctestdouble
classesfunctionsstatic variablesstructs