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

summaryrefslogtreecommitdiffhomepage
path: root/examples/200-Rpt-CatchMain.cpp
diff options
context:
space:
mode:
authorMartin Moene2017-11-29 21:22:38 +0100
committerMartin Hořeňovský2018-09-27 23:20:02 +0200
commit558bbe7d24a89bf11a0f57a86c733e28840c4d6f (patch)
treed272977a1a45d0827ce3c5ca2609529290dd8bb3 /examples/200-Rpt-CatchMain.cpp
parentf4881f172afa4eab26f2e4bed8c5dfeb010567a5 (diff)
downloadcatch3-558bbe7d24a89bf11a0f57a86c733e28840c4d6f.tar.gz
Add example for TeamCity reporter and refer to it
Prevent warnings - gnu: -Wcomment: multi-line comment - clang: -Wweak-vtables 'class' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit - clang: -Winconsistent-missing-override: 'method' overrides a member function but is not marked 'override' - MSVC: C4702: unreachable code
Diffstat (limited to 'examples/200-Rpt-CatchMain.cpp')
-rw-r--r--examples/200-Rpt-CatchMain.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/examples/200-Rpt-CatchMain.cpp b/examples/200-Rpt-CatchMain.cpp
new file mode 100644
index 00000000..b84c804d
--- /dev/null
+++ b/examples/200-Rpt-CatchMain.cpp
@@ -0,0 +1,27 @@
+// 200-Rpt-CatchMain.cpp
+
+// In a Catch project with multiple files, dedicate one file to compile the
+// source code of Catch itself and reuse the resulting object file for linking.
+
+// Let Catch provide main():
+#define CATCH_CONFIG_MAIN
+
+#include <catch2/catch.hpp>
+
+#ifdef CATCH_EXAMPLE_RPT_1
+#include CATCH_EXAMPLE_RPT_1
+#endif
+
+#ifdef CATCH_EXAMPLE_RPT_2
+#include CATCH_EXAMPLE_RPT_2
+#endif
+
+#ifdef CATCH_EXAMPLE_RPT_3
+#include CATCH_EXAMPLE_RPT_3
+#endif
+
+// That's it
+
+// Compile implementation of Catch for use with files that do contain tests:
+// - g++ -std=c++11 -Wall -I$(CATCH_ROOT) -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -o 200-Rpt-CatchMainTeamCity.o -c 200-Rpt-CatchMain.cpp
+// cl -EHsc -I%CATCH_ROOT% -DCATCH_EXAMPLE_RPT_1=\"include/reporters/catch_reporter_teamcity.hpp\" -Fo200-Rpt-CatchMainTeamCity.obj -c 200-Rpt-CatchMain.cpp