From 1a3f6d829baaf45d79c63632f0668bec157930c4 Mon Sep 17 00:00:00 2001 From: Phil Nash Date: Wed, 1 Feb 2017 14:37:02 +0000 Subject: [PATCH] Updated command line docs with info on -c for running sections, as well as -# for filenames as tags --- docs/command-line.md | 56 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/docs/command-line.md b/docs/command-line.md index c39122d6..3b8f1816 100644 --- a/docs/command-line.md +++ b/docs/command-line.md @@ -17,6 +17,9 @@ Click one of the followings links to take you straight to that option - or scrol ` -w, --warn`
` -d, --durations`
` -f, --input-file`
+ ` -c, --section`
+ ` -#, --filenames-as-tags`
+
@@ -217,6 +220,59 @@ In either case the actual value for the seed is printed as part of Catch's outpu Prints the command line arguments to stdout + + +## Specify the section to run +
-s, --section <section name>
+ +To limit exection to a specific section within a test case, use this option one or more times. +To narrow to sub-sections use multiple instances, where each subsequent instance specifies a deeper nesting level. + +E.g. if you have: + +
+TEST_CASE( "Test" ) {
+  SECTION( "sa" ) {
+    SECTION( "sb" ) {
+      /*...*/
+    }
+    SECTION( "sc" ) {
+      /*...*/
+    }
+  }
+  SECTION( "sd" ) {
+    /*...*/
+  }
+}
+
+ +Then you can run `sb` with: +
./MyExe Test -c sa -c sb
+ +Or run just `sd` with: +
./MyExe Test -c sd
+ +To run all of `sa`, including `sb` and `sc` use: +
./MyExe Test -c sa
+ +There are some limitations of this feature to be aware of: +- Code outside of sections being skipped will still be executed - e.g. any set-up code in the TEST_CASE before the +start of the first section.
+- At time of writing, wildcards are not supported in section names. +- If you specify a section without narrowing to a test case first then all test cases will be executed +(but only matching sections within them). + + + +## Filenames as tags +
-#, --filenames-as-tags
+ +When this option is used then every test is given an additional tag which is formed of the unqualified +filename it is found in, with any extension stripped, prefixed with the `#` character. + +So, for example, tests within the file `~\Dev\MyProject\Ferrets.cpp` would be tagged `[#Ferrets]`. + + --- [Home](Readme.md)