Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorMartin Hořeňovský2021-12-13 15:15:23 +0100
committerMartin Hořeňovský2021-12-18 20:50:00 +0100
commit9f2dca5384a6a8f9f37a7dc2d998cac616545592 (patch)
tree181d46f4eb905903e08af58a8a35108f87a24505 /docs
parent602e484f027ccdfb59cfde852e20283ad1635f81 (diff)
downloadcatch3-9f2dca5384a6a8f9f37a7dc2d998cac616545592.tar.gz
Exit with non-0 return code if no tests were run
A new flag, `--allow-running-no-tests` was added to override this behaviour if exit code of 0 was desired. This change also made `-w NoTests` obsolete, and so it has been removed.
Diffstat (limited to 'docs')
-rw-r--r--docs/command-line.md19
-rw-r--r--docs/release-notes.md3
2 files changed, 18 insertions, 4 deletions
diff --git a/docs/command-line.md b/docs/command-line.md
index 0154f075..40195eb4 100644
--- a/docs/command-line.md
+++ b/docs/command-line.md
@@ -30,6 +30,7 @@
[Filenames as tags](#filenames-as-tags)<br>
[Override output colouring](#override-output-colouring)<br>
[Test Sharding](#test-sharding)<br>
+[Allow running the binary without tests](#no-tests-override)<br>
Catch works quite nicely without any command line options at all - but for those times when you want greater control the following options are available.
Click one of the following links to take you straight to that option - or scroll on to browse the available options.
@@ -70,6 +71,7 @@ Click one of the following links to take you straight to that option - or scroll
<a href="#use-colour"> ` --use-colour`</a><br />
<a href="#test-sharding"> ` --shard-count`</a><br />
<a href="#test-sharding"> ` --shard-index`</a><br />
+<a href=#no-tests-override> ` --allow-running-no-tests`</a><br />
</br>
@@ -210,14 +212,12 @@ This option transforms tabs and newline characters into ```\t``` and ```\n``` re
## Warnings
<pre>-w, --warn &lt;warning name></pre>
-Enables reporting of suspicious test states. There are currently two
-available warnings
+Enables reporting of suspicious test runs. There is currently only one
+available warning.
```
NoAssertions // Fail test case / leaf section if no assertions
// (e.g. `REQUIRE`) is encountered.
- NoTests // Return non-zero exit code when no test cases were run
- // Also calls reporter's noMatchingTestCases method
```
@@ -441,6 +441,17 @@ the number of shards.
This is useful when you want to split test execution across multiple processes, as is done with [Bazel test sharding](https://docs.bazel.build/versions/main/test-encyclopedia.html#test-sharding).
+<a id="no-tests-override"></a>
+## Allow running the binary without tests
+<pre>--allow-running-no-tests</pre>
+
+> Introduced in Catch2 X.Y.Z.
+
+By default, Catch2 test binaries return non-0 exit code if no tests were
+run, e.g. if the binary was compiled with no tests, or the provided test
+spec matched no tests. This flag overrides that, so a test run with no
+tests still returns 0.
+
---
diff --git a/docs/release-notes.md b/docs/release-notes.md
index ca14092a..3eecf8f8 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -198,6 +198,9 @@ new design.
* `catch2` is the statically compiled implementation by itself
* `catch2-with-main` also links in the default main
* Passing invalid test specifications passed to Catch2 are now reported before tests are run, and are a hard error.
+* Running 0 tests (e.g. due to empty binary, or test spec not matching anything) returns non-0 exit code
+ * Flag `--allow-running-no-tests` overrides this behaviour.
+ * `NoTests` warning has been removed because it is fully subsumed by this change.