- fixed bug that was introduced in commit 0b0b82f1728f65075724b41aca83c62834978d44 - should have made these changes in a separate commit for easier testing
- regenerated test output so the tests pass
diff --git a/doctest/doctest.h b/doctest/doctest.h
index c97e32a..43538b0 100644
--- a/doctest/doctest.h
+++ b/doctest/doctest.h
@@ -331,6 +331,9 @@
#define DOCTEST_TOSTR(x) DOCTEST_TOSTR_IMPL(x)
#endif // DOCTEST_CONFIG_WITH_VARIADIC_MACROS
+// for concatenating literals and making the result a string
+#define DOCTEST_STR_CONCAT_TOSTR(s1, s2) DOCTEST_TOSTR(s1) DOCTEST_TOSTR(s2)
+
// counts the number of elements in a C string
#define DOCTEST_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
@@ -4084,8 +4087,8 @@
String strRes;
#define DOCTEST_PARSE_AS_BOOL_OR_FLAG(name, sname, var, default) \
- if(parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_bool, intRes) || \
- parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_bool, intRes)) \
+ if(parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(name, =), option_bool, intRes) || \
+ parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(sname, =), option_bool, intRes)) \
p->var = !!intRes; \
else if(parseFlag(argc, argv, #name) || parseFlag(argc, argv, #sname)) \
p->var = 1; \
@@ -4093,15 +4096,16 @@
p->var = default
#define DOCTEST_PARSE_INT_OPTION(name, sname, var, default) \
- if(parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_int, intRes) || \
- parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_int, intRes)) \
+ if(parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(name, =), option_int, intRes) || \
+ parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(sname, =), option_int, intRes)) \
p->var = intRes; \
else if(withDefaults) \
p->var = default
#define DOCTEST_PARSE_STR_OPTION(name, sname, var, default) \
- if(parseOption(argc, argv, DOCTEST_TOSTR(name) "=", strRes, default) || \
- parseOption(argc, argv, DOCTEST_TOSTR(name) "=", strRes, default) || withDefaults) \
+ if(parseOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(name, =), strRes, default) || \
+ parseOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(sname, =), strRes, default) || \
+ withDefaults) \
p->var = strRes
// clang-format off
diff --git a/doctest/parts/doctest_fwd.h b/doctest/parts/doctest_fwd.h
index 2e7f191..5b873e2 100644
--- a/doctest/parts/doctest_fwd.h
+++ b/doctest/parts/doctest_fwd.h
@@ -328,6 +328,9 @@
#define DOCTEST_TOSTR(x) DOCTEST_TOSTR_IMPL(x)
#endif // DOCTEST_CONFIG_WITH_VARIADIC_MACROS
+// for concatenating literals and making the result a string
+#define DOCTEST_STR_CONCAT_TOSTR(s1, s2) DOCTEST_TOSTR(s1) DOCTEST_TOSTR(s2)
+
// counts the number of elements in a C string
#define DOCTEST_COUNTOF(x) (sizeof(x) / sizeof(x[0]))
diff --git a/doctest/parts/doctest_impl.h b/doctest/parts/doctest_impl.h
index 2a8a439..fcd71c1 100644
--- a/doctest/parts/doctest_impl.h
+++ b/doctest/parts/doctest_impl.h
@@ -1677,8 +1677,8 @@
String strRes;
#define DOCTEST_PARSE_AS_BOOL_OR_FLAG(name, sname, var, default) \
- if(parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_bool, intRes) || \
- parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_bool, intRes)) \
+ if(parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(name, =), option_bool, intRes) || \
+ parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(sname, =), option_bool, intRes)) \
p->var = !!intRes; \
else if(parseFlag(argc, argv, #name) || parseFlag(argc, argv, #sname)) \
p->var = 1; \
@@ -1686,15 +1686,16 @@
p->var = default
#define DOCTEST_PARSE_INT_OPTION(name, sname, var, default) \
- if(parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_int, intRes) || \
- parseIntOption(argc, argv, DOCTEST_TOSTR(name) "=", option_int, intRes)) \
+ if(parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(name, =), option_int, intRes) || \
+ parseIntOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(sname, =), option_int, intRes)) \
p->var = intRes; \
else if(withDefaults) \
p->var = default
#define DOCTEST_PARSE_STR_OPTION(name, sname, var, default) \
- if(parseOption(argc, argv, DOCTEST_TOSTR(name) "=", strRes, default) || \
- parseOption(argc, argv, DOCTEST_TOSTR(name) "=", strRes, default) || withDefaults) \
+ if(parseOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(name, =), strRes, default) || \
+ parseOption(argc, argv, DOCTEST_STR_CONCAT_TOSTR(sname, =), strRes, default) || \
+ withDefaults) \
p->var = strRes
// clang-format off
diff --git a/examples/assertion_macros/test_output/assertion_macros.txt b/examples/assertion_macros/test_output/assertion_macros.txt
index a064e75..81e184a 100644
--- a/examples/assertion_macros/test_output/assertion_macros.txt
+++ b/examples/assertion_macros/test_output/assertion_macros.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
an empty test that will fail because of an exception
@@ -7,7 +7,7 @@
threw exception:
unknown exception
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
an empty test that will fail because of a std::exception
@@ -15,7 +15,7 @@
threw exception:
whops!
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
normal macros
@@ -33,7 +33,7 @@
threw exception:
unknown exception
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
normal macros with std::exception
@@ -51,7 +51,7 @@
threw exception:
unknown exception
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
exceptions-related macros
@@ -73,7 +73,7 @@
threw exception:
unknown exception
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
exceptions-related macros for std::exception
diff --git a/examples/dll_and_executable/test_output/dll_and_executable.txt b/examples/dll_and_executable/test_output/dll_and_executable.txt
index 558f24c..f8e9f4d 100644
--- a/examples/dll_and_executable/test_output/dll_and_executable.txt
+++ b/examples/dll_and_executable/test_output/dll_and_executable.txt
@@ -3,7 +3,7 @@
I am a test from the implementation!
I am a test from the implementation_2!
I am a test from the executable!
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
executable
diff --git a/examples/hello_world/test_output/hello_world.txt b/examples/hello_world/test_output/hello_world.txt
index e713d6a..a63fa43 100644
--- a/examples/hello_world/test_output/hello_world.txt
+++ b/examples/hello_world/test_output/hello_world.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
testing the factorial function
diff --git a/examples/multi_file_example/test_output/multi_file_example.txt b/examples/multi_file_example/test_output/multi_file_example.txt
index 4c10c65..390ddce 100644
--- a/examples/multi_file_example/test_output/multi_file_example.txt
+++ b/examples/multi_file_example/test_output/multi_file_example.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
f1.cpp(0)
f1.cpp
@@ -8,7 +8,7 @@
with expansion:
CHECK( 1 == 0 )
-===============================================================================
+== TEST CASE ==================================================================
f2.cpp(0)
f2.cpp
@@ -17,7 +17,7 @@
with expansion:
CHECK( 1 == 0 )
-===============================================================================
+== TEST CASE ==================================================================
hdr.h(0)
hdr.h
diff --git a/examples/removing_doctest_options/test_output/removing_doctest_options.txt b/examples/removing_doctest_options/test_output/removing_doctest_options.txt
index 6ec7587..9547a75 100644
--- a/examples/removing_doctest_options/test_output/removing_doctest_options.txt
+++ b/examples/removing_doctest_options/test_output/removing_doctest_options.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
Fail
diff --git a/examples/separate_headers/test_output/separate_headers.txt b/examples/separate_headers/test_output/separate_headers.txt
index 60cda4d..05d55d4 100644
--- a/examples/separate_headers/test_output/separate_headers.txt
+++ b/examples/separate_headers/test_output/separate_headers.txt
@@ -1,30 +1,92 @@
[doctest] run with "--help" for options
-Hello world!
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
-stuff
+trololo<?>
+
+test.cpp(0) ERROR!
+ CHECK( sizeof(typename T::A) == static_cast<unsigned>(4) )
+with expansion:
+ CHECK( 1 == 4 )
+
+== TEST CASE ==================================================================
+test.cpp(0)
+trololo<?>
+
+test.cpp(0) ERROR!
+ CHECK( sizeof(typename T::B) == static_cast<unsigned>(4) )
+with expansion:
+ CHECK( 1 == 4 )
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<int>
test.cpp(0) MESSAGE!
- lala: 542
-with context:
- 5
+ aaa
-test.cpp(0) WARNING!
- WARN( 1 == throws(true) )
-threw exception:
- unknown exception
-with context:
- 5
- sdf5
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<char>
-test.cpp(0) WARNING!
- WARN_THROWS_AS( throws(true), char )
-threw a different exception:
- unknown exception
-with context:
- 5
- sad
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<?>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<double>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<int>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<int>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<char>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<?>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<double>
+
+test.cpp(0) MESSAGE!
+ aaa
+
+== TEST CASE ==================================================================
+test.cpp(0)
+separate<int>
+
+test.cpp(0) MESSAGE!
+ aaa
===============================================================================
-[doctest] test cases: 1 | 1 passed | 0 failed | 0 skipped
-[doctest] assertions: 0 | 0 passed | 0 failed |
+[doctest] test cases: 12 | 10 passed | 2 failed | 0 skipped
+[doctest] assertions: 4 | 2 passed | 2 failed |
diff --git a/examples/stringification/test_output/stringification.txt b/examples/stringification/test_output/stringification.txt
index 3c218df..dc7cb1d 100644
--- a/examples/stringification/test_output/stringification.txt
+++ b/examples/stringification/test_output/stringification.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
the only test
@@ -27,7 +27,7 @@
threw exception:
MyTypeInherited<int>(5, 4.0f)
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
a test case that registers an exception translator for int and then throws one
diff --git a/examples/subcases_and_bdd/test_output/subcases_and_bdd.txt b/examples/subcases_and_bdd/test_output/subcases_and_bdd.txt
index c8d6673..c3af1a6 100644
--- a/examples/subcases_and_bdd/test_output/subcases_and_bdd.txt
+++ b/examples/subcases_and_bdd/test_output/subcases_and_bdd.txt
@@ -10,7 +10,7 @@
root
2
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
lots of nested subcases
@@ -18,7 +18,7 @@
threw exception:
unknown exception
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
Scenario: vectors can be sized and resized
Given: A vector with some items
@@ -30,7 +30,7 @@
with expansion:
CHECK( 10 == 20 )
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
Scenario: vectors can be sized and resized
Given: A vector with some items
@@ -42,7 +42,7 @@
with expansion:
CHECK( 5 == 10 )
-===============================================================================
+== TEST CASE ==================================================================
main.cpp(0)
test with a fixture - 2
diff --git a/scripts/code_coverage_source/test_output/abort_after.txt b/scripts/code_coverage_source/test_output/abort_after.txt
index 83fd877..cc8f8a4 100644
--- a/scripts/code_coverage_source/test_output/abort_after.txt
+++ b/scripts/code_coverage_source/test_output/abort_after.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
@@ -9,7 +9,7 @@
with expansion:
CHECK( 0 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
diff --git a/scripts/code_coverage_source/test_output/filter_1.txt b/scripts/code_coverage_source/test_output/filter_1.txt
index f88cc63..4f77fd0 100644
--- a/scripts/code_coverage_source/test_output/filter_1.txt
+++ b/scripts/code_coverage_source/test_output/filter_1.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
@@ -36,7 +36,7 @@
REQUIRE_THROWS_AS( throws(false), bool )
didn't throw at all
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions - all of them
diff --git a/scripts/code_coverage_source/test_output/filter_2.txt b/scripts/code_coverage_source/test_output/filter_2.txt
index b1f5047..5ceadb5 100644
--- a/scripts/code_coverage_source/test_output/filter_2.txt
+++ b/scripts/code_coverage_source/test_output/filter_2.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
@@ -9,7 +9,7 @@
with expansion:
CHECK( 0 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
throws
diff --git a/scripts/code_coverage_source/test_output/filter_5.txt b/scripts/code_coverage_source/test_output/filter_5.txt
index 4befb0a..6634ddd 100644
--- a/scripts/code_coverage_source/test_output/filter_5.txt
+++ b/scripts/code_coverage_source/test_output/filter_5.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
@@ -36,7 +36,7 @@
REQUIRE_THROWS_AS( throws(false), bool )
didn't throw at all
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions - all of them
@@ -45,7 +45,7 @@
with expansion:
FAST_REQUIRE_UNARY_FALSE( 1 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
throws
diff --git a/scripts/code_coverage_source/test_output/filter_6.txt b/scripts/code_coverage_source/test_output/filter_6.txt
index 01e30d9..9102e5c 100644
--- a/scripts/code_coverage_source/test_output/filter_6.txt
+++ b/scripts/code_coverage_source/test_output/filter_6.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
diff --git a/scripts/code_coverage_source/test_output/first_last.txt b/scripts/code_coverage_source/test_output/first_last.txt
index bdf5e80..c3725af 100644
--- a/scripts/code_coverage_source/test_output/first_last.txt
+++ b/scripts/code_coverage_source/test_output/first_last.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
@@ -9,7 +9,7 @@
with expansion:
CHECK( 0 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
diff --git a/scripts/code_coverage_source/test_output/order_1.txt b/scripts/code_coverage_source/test_output/order_1.txt
index a34eb28..8b200e4 100644
--- a/scripts/code_coverage_source/test_output/order_1.txt
+++ b/scripts/code_coverage_source/test_output/order_1.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
@@ -9,7 +9,7 @@
with expansion:
CHECK( 0 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
@@ -46,7 +46,7 @@
REQUIRE_THROWS_AS( throws(false), bool )
didn't throw at all
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions - all of them
@@ -55,7 +55,7 @@
with expansion:
FAST_REQUIRE_UNARY_FALSE( 1 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
throws
diff --git a/scripts/code_coverage_source/test_output/order_2.txt b/scripts/code_coverage_source/test_output/order_2.txt
index ee07487..e40a34a 100644
--- a/scripts/code_coverage_source/test_output/order_2.txt
+++ b/scripts/code_coverage_source/test_output/order_2.txt
@@ -1,5 +1,5 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
@@ -36,7 +36,7 @@
REQUIRE_THROWS_AS( throws(false), bool )
didn't throw at all
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions - all of them
@@ -45,7 +45,7 @@
with expansion:
FAST_REQUIRE_UNARY_FALSE( 1 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
@@ -55,7 +55,7 @@
with expansion:
CHECK( 0 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
throws
diff --git a/scripts/code_coverage_source/test_output/successful.txt b/scripts/code_coverage_source/test_output/successful.txt
index bb43168..7345654 100644
--- a/scripts/code_coverage_source/test_output/successful.txt
+++ b/scripts/code_coverage_source/test_output/successful.txt
@@ -1,9 +1,9 @@
[doctest] run with "--help" for options
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
subcases
2
@@ -13,7 +13,7 @@
with expansion:
CHECK( 0 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
expressions should be evaluated only once
@@ -27,7 +27,7 @@
with expansion:
REQUIRE_EQ( 7, 7 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions
@@ -78,7 +78,7 @@
REQUIRE_THROWS_AS( throws(false), bool )
didn't throw at all
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
assertions - all of them
@@ -379,7 +379,7 @@
with expansion:
FAST_REQUIRE_UNARY_FALSE( 1 )
-===============================================================================
+== TEST CASE ==================================================================
test.cpp(0)
throws