Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Expanded logging documentation

Closes #884
Commit
1ea84cb734a9724c34525bd8aa2c8fabe1568403
Author
Martin Hořeňovský ·
Parents
3dcc9233515e

Files · Download .tar.gz

Changes

 docs/logging.md | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/docs/logging.md b/docs/logging.md
index 01c6fbc7..afbfd224 100644
--- a/docs/logging.md
+++ b/docs/logging.md
@@ -1,6 +1,32 @@
 # Logging macros
 
-Additional messages can be logged during a test case.
+Additional messages can be logged during a test case. Note that the messages are scoped and thus will not be reported if failure occurs in scope preceding the message declaration. An example:
+
+```cpp
+TEST_CASE("Foo") {
+    INFO("Test case start");
+    for (int i = 0; i < 2; ++i) {
+        INFO("The number is " << i);
+        CHECK(i == 0);
+    }
+}
+
+TEST_CASE("Bar") {
+    INFO("Test case start");
+    for (int i = 0; i < 2; ++i) {
+        INFO("The number is " << i);
+        CHECK(i == i);
+    }
+    CHECK(false);
+}
+```
+When the `CHECK` fails in the "Foo" test case, then two messages will be printed.
+```
+Test case start
+The number is 1
+```
+When the last `CHECK` fails in the "Bar" test case, then only one message will be printed: `Test case start`.
+
 
 ## Streaming macros