File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -36,8 +36,16 @@ endif()
36
36
# example
37
37
38
38
if (WITH_TESTS )
39
- add_executable (docopt_testcase run_testcase.cpp )
40
- target_link_libraries (docopt_testcase docopt )
39
+ set (TESTPROG "${CMAKE_CURRENT_BINARY_DIR} /run_testcase" )
40
+ set (TESTCASES "${PROJECT_SOURCE_DIR} /testcases.docopt" )
41
+ add_executable (run_testcase run_testcase.cpp )
42
+ target_link_libraries (run_testcase docopt )
43
+ configure_file (
44
+ "${PROJECT_SOURCE_DIR} /run_tests.py"
45
+ "${CMAKE_CURRENT_BINARY_DIR} /run_tests"
46
+ ESCAPE_QUOTES
47
+ )
48
+ add_test ("Testcases docopt" ${TESTPROG} )
41
49
endif ()
42
50
43
51
########################################################################
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python2
2
+
1
3
import re
2
4
import json
3
5
import subprocess
4
6
5
- executable = "./run_testcase "
7
+ executable = "${TESTPROG} "
6
8
7
9
def parse_test (raw ):
8
10
raw = re .compile ('#.*$' , re .M ).sub ('' , raw ).strip ()
@@ -24,7 +26,7 @@ def parse_test(raw):
24
26
failures = 0
25
27
passes = 0
26
28
27
- tests = open ('testcases.docopt ' ,'r' ).read ()
29
+ tests = open ('${TESTCASES} ' ,'r' ).read ()
28
30
for _ , doc , cases in parse_test (tests ):
29
31
if not cases : continue
30
32
You can’t perform that action at this time.
0 commit comments