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

summaryrefslogtreecommitdiffhomepage
path: root/docs
diff options
context:
space:
mode:
authorMartin Hořeňovský2017-05-16 14:34:20 +0200
committerMartin Hořeňovský2017-05-16 14:34:20 +0200
commit1ea84cb734a9724c34525bd8aa2c8fabe1568403 (patch)
treedc39d1b688c2523408183484c970255ad98d8100 /docs
parent3dcc9233515ea69e45a11be369f867a944e72e76 (diff)
downloadcatch3-1ea84cb734a9724c34525bd8aa2c8fabe1568403.tar.gz
Expanded logging documentation
Closes #884
Diffstat (limited to 'docs')
-rw-r--r--docs/logging.md28
1 files changed, 27 insertions, 1 deletions
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