Skip to content

Commit

Permalink
Fix CTest command issue with square brackets
Browse files Browse the repository at this point in the history
  • Loading branch information
sfranzen committed Jul 21, 2019
1 parent fb74bb1 commit 2aed623
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions contrib/CatchAddTests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ string(REPLACE "\n" ";" output "${output}")
# Parse output
foreach(line ${output})
set(test ${line})
# use escape commas to handle properly test cases with commans inside the name
string(REPLACE "," "\\," test_name ${test})
# Escape characters in test case names that would be parsed by Catch2
set(test_name ${test})
foreach(char , [ ])
string(REPLACE ${char} "\\${char}" test_name ${test_name})
endforeach(char)
# ...and add to script
add_command(add_test
"${prefix}${test}${suffix}"
Expand Down

0 comments on commit 2aed623

Please sign in to comment.