Skip to content

Commit

Permalink
fixed #19
Browse files Browse the repository at this point in the history
  • Loading branch information
onqtam committed Jun 4, 2016
1 parent b34c431 commit 7edb72a
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 16 deletions.
6 changes: 3 additions & 3 deletions doctest/doctest.h
Expand Up @@ -2223,7 +2223,7 @@ namespace detail
break;
}
}
if(noBadCharsFound)
if(noBadCharsFound && argv[i][0] == '-')
return true;
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
6 changes: 3 additions & 3 deletions doctest/parts/doctest_impl.h
Expand Up @@ -1193,7 +1193,7 @@ namespace detail
break;
}
}
if(noBadCharsFound)
if(noBadCharsFound && argv[i][0] == '-')
return true;
}
}
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
12 changes: 6 additions & 6 deletions examples/assertion_macros/test_output/assertion_macros.txt
Expand Up @@ -13,27 +13,27 @@ 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 )

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) )

===============================================================================
Expand Down
2 changes: 1 addition & 1 deletion examples/range_based_execution/CMakeLists.txt
Expand Up @@ -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 $<TARGET_FILE:${PROJECT_NAME}>)
add_test(NO_VALGRIND NO_OUTPUT NAME ${PROJECT_NAME} COMMAND python ${CMAKE_CURRENT_SOURCE_DIR}/run.py $<TARGET_FILE:${PROJECT_NAME}>)
2 changes: 1 addition & 1 deletion examples/separate_headers/test.cpp
@@ -1,5 +1,5 @@
#include "parts/doctest_fwd.h"

TEST_CASE("captain obvious") {
CHECK(true == true);
CHECK(true == false);
}
13 changes: 11 additions & 2 deletions 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 |

0 comments on commit 7edb72a

Please sign in to comment.