summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2003-11-03 20:19:27 (GMT)
committerBrad King <brad.king@kitware.com>2003-11-03 20:19:27 (GMT)
commit5f30c8caac40c930abab4f8c6a9f3fd0ddf1280d (patch)
tree0b6bb3062cf50c69a3b2c019a7f5f96d932e01a2 /Source/cmAddTestCommand.cxx
parentf60e16f8ab6c6216be885fb1dc36fd9e6871c5df (diff)
downloadCMake-5f30c8caac40c930abab4f8c6a9f3fd0ddf1280d.zip
CMake-5f30c8caac40c930abab4f8c6a9f3fd0ddf1280d.tar.gz
CMake-5f30c8caac40c930abab4f8c6a9f3fd0ddf1280d.tar.bz2
BUG#259: ADD_TEST command generated in DartTestfile.txt now quotes/escapes all arguments.
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 5802779..4a2cb20 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -67,18 +67,23 @@ void cmAddTestCommand::FinalPass()
++it;
for (; it != m_Args.end(); ++it)
{
- if(it->find(" ") != std::string::npos)
+ // Just double-quote all arguments so they are re-parsed
+ // correctly by the test system.
+ fout << " \"";
+ for(std::string::iterator c = it->begin(); c != it->end(); ++c)
+ {
+ // Escape quotes and backslashes within arguments.
+ if((*c == '"') || (*c == '\\'))
{
- fout << " \"" << *it << "\"";
- }
- else
- {
- fout << " " << *it;
+ fout << '\\';
}
+ fout << *c;
+ }
+ fout << "\"";
}
fout << ")" << std::endl;
fout.close();
- }
+ }
return;
}