diff --git a/doctest/doctest.h b/doctest/doctest.h index 7368d977d..352af038b 100644 --- a/doctest/doctest.h +++ b/doctest/doctest.h @@ -2223,7 +2223,7 @@ namespace detail break; } } - if(noBadCharsFound) + if(noBadCharsFound && argv[i][0] == '-') return true; } } @@ -2255,7 +2255,7 @@ namespace detail break; } } - if(noBadCharsFound) { + if(noBadCharsFound && argv[i][0] == '-') { temp += my_strlen(pattern); unsigned len = my_strlen(temp); if(len) { @@ -2523,7 +2523,7 @@ void Context::setOption(const char* option, int value) { // allows the user to override procedurally the string options from the command line void Context::setOption(const char* option, const char* value) { - String argv = String(option) + "=" + value; + String argv = String("-") + option + "=" + value; const char* lvalue = argv.c_str(); parseArgs(1, &lvalue); } diff --git a/doctest/parts/doctest_impl.h b/doctest/parts/doctest_impl.h index 133918152..47c7576d5 100644 --- a/doctest/parts/doctest_impl.h +++ b/doctest/parts/doctest_impl.h @@ -1193,7 +1193,7 @@ namespace detail break; } } - if(noBadCharsFound) + if(noBadCharsFound && argv[i][0] == '-') return true; } } @@ -1225,7 +1225,7 @@ namespace detail break; } } - if(noBadCharsFound) { + if(noBadCharsFound && argv[i][0] == '-') { temp += my_strlen(pattern); unsigned len = my_strlen(temp); if(len) { @@ -1493,7 +1493,7 @@ void Context::setOption(const char* option, int value) { // allows the user to override procedurally the string options from the command line void Context::setOption(const char* option, const char* value) { - String argv = String(option) + "=" + value; + String argv = String("-") + option + "=" + value; const char* lvalue = argv.c_str(); parseArgs(1, &lvalue); } diff --git a/examples/assertion_macros/test_output/assertion_macros.txt b/examples/assertion_macros/test_output/assertion_macros.txt index 2fa7c12c5..106df5d3f 100644 --- a/examples/assertion_macros/test_output/assertion_macros.txt +++ b/examples/assertion_macros/test_output/assertion_macros.txt @@ -13,7 +13,7 @@ normal macros main.cpp(24) FAILED! (threw exception) CHECK( throws(true) == 42 ) -main.cpp(32) FAILED! +main.cpp(33) FAILED! CHECK( Approx(0.502) == 0.501 ) with expansion: CHECK( Approx( 0.502 ) == 0.501 ) @@ -21,19 +21,19 @@ with expansion: TEST CASE FAILED! (threw exception) =============================================================================== -main.cpp(41) +main.cpp(42) exceptions-related macros -main.cpp(42) FAILED! +main.cpp(43) FAILED! CHECK_THROWS( throws(false) ) -main.cpp(43) FAILED! (didn't throw at all) +main.cpp(44) FAILED! (didn't throw at all) CHECK_THROWS_AS( throws(false), int ) -main.cpp(45) FAILED! (threw something else) +main.cpp(46) FAILED! (threw something else) CHECK_THROWS_AS( throws(true), char ) -main.cpp(47) FAILED! +main.cpp(48) FAILED! REQUIRE_NOTHROW( throws(true) ) =============================================================================== diff --git a/examples/range_based_execution/CMakeLists.txt b/examples/range_based_execution/CMakeLists.txt index 10f41c5f2..4e20120bd 100644 --- a/examples/range_based_execution/CMakeLists.txt +++ b/examples/range_based_execution/CMakeLists.txt @@ -9,4 +9,4 @@ include_directories("../../doctest/") add_executable(${PROJECT_NAME} main.cpp) -add_test(NO_VALGRIND NO_OUTPUT NAME ${PROJECT_NAME}_1 COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/run.py $) +add_test(NO_VALGRIND NO_OUTPUT NAME ${PROJECT_NAME} COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/run.py $) diff --git a/examples/separate_headers/test.cpp b/examples/separate_headers/test.cpp index 7b351de32..41dc44a22 100644 --- a/examples/separate_headers/test.cpp +++ b/examples/separate_headers/test.cpp @@ -1,5 +1,5 @@ #include "parts/doctest_fwd.h" TEST_CASE("captain obvious") { - CHECK(true == true); + CHECK(true == false); } diff --git a/examples/separate_headers/test_output/separate_headers.txt b/examples/separate_headers/test_output/separate_headers.txt index 076578525..4db59624a 100644 --- a/examples/separate_headers/test_output/separate_headers.txt +++ b/examples/separate_headers/test_output/separate_headers.txt @@ -1,5 +1,14 @@ [doctest] doctest version is "1.0.0" [doctest] run with "--help" for options =============================================================================== -[doctest] test cases: 1 | 1 passed | 0 failed | 0 skipped -[doctest] assertions: 1 | 1 passed | 0 failed | +test.cpp(3) +captain obvious + +test.cpp(4) FAILED! + CHECK( true == false ) +with expansion: + CHECK( true == false ) + +=============================================================================== +[doctest] test cases: 1 | 0 passed | 1 failed | 0 skipped +[doctest] assertions: 1 | 0 passed | 1 failed |