summaryrefslogtreecommitdiffstats
path: root/Source/cmTestGenerator.cxx
diff options
context:
space:
mode:
authorDeniz Bahadir <dbahadir@benocs.com>2020-05-15 23:52:34 (GMT)
committerDeniz Bahadir <dbahadir@benocs.com>2020-05-17 08:53:14 (GMT)
commitf84af8e270f33e55af4d731510f6ae5eaaddcb5f (patch)
tree651842648a61a0d1d8b8affa5f73323c518bdc8d /Source/cmTestGenerator.cxx
parentec1b3992dbfb54edb777988766440295f1f1f1d3 (diff)
downloadCMake-f84af8e270f33e55af4d731510f6ae5eaaddcb5f.zip
CMake-f84af8e270f33e55af4d731510f6ae5eaaddcb5f.tar.gz
CMake-f84af8e270f33e55af4d731510f6ae5eaaddcb5f.tar.bz2
add_test: Allow special characters in test name
Fixes: #19391
Diffstat (limited to 'Source/cmTestGenerator.cxx')
-rw-r--r--Source/cmTestGenerator.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx
index 025a7b3..4e41993 100644
--- a/Source/cmTestGenerator.cxx
+++ b/Source/cmTestGenerator.cxx
@@ -76,7 +76,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
cmGeneratorExpression ge(this->Test->GetBacktrace());
// Start the test command.
- os << indent << "add_test(" << this->Test->GetName() << " ";
+ os << indent << "add_test(\"" << this->Test->GetName() << "\" ";
// Evaluate command line arguments
std::vector<std::string> argv =
@@ -126,8 +126,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
os << ")\n";
// Output properties for the test.
- os << indent << "set_tests_properties(" << this->Test->GetName()
- << " PROPERTIES ";
+ os << indent << "set_tests_properties(\"" << this->Test->GetName()
+ << "\" PROPERTIES ";
for (auto const& i : this->Test->GetProperties().GetList()) {
os << " " << i.first << " "
<< cmOutputConverter::EscapeForCMake(
@@ -139,7 +139,8 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os,
void cmTestGenerator::GenerateScriptNoConfig(std::ostream& os, Indent indent)
{
- os << indent << "add_test(" << this->Test->GetName() << " NOT_AVAILABLE)\n";
+ os << indent << "add_test(\"" << this->Test->GetName()
+ << "\" NOT_AVAILABLE)\n";
}
bool cmTestGenerator::NeedsScriptNoConfig() const
@@ -159,9 +160,8 @@ void cmTestGenerator::GenerateOldStyle(std::ostream& fout, Indent indent)
std::string exe = command[0];
cmSystemTools::ConvertToUnixSlashes(exe);
- fout << indent;
- fout << "add_test(";
- fout << this->Test->GetName() << " \"" << exe << "\"";
+ fout << indent << "add_test(\"" << this->Test->GetName() << "\" \"" << exe
+ << "\"";
for (std::string const& arg : cmMakeRange(command).advance(1)) {
// Just double-quote all arguments so they are re-parsed