From 821247ef4d8dc95bf0bc8cb1ba25331593fb404c Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 10 Aug 2009 09:07:59 -0400 Subject: Cleanup test property script code generation We teach cmTestGenerator::GenerateScriptConfigs to use the general cmLocalGenerator::EscapeForCMake method to write escaped test property values into test scripts. This eliminates the previous hand-coded escaping implementation. --- Source/cmTestGenerator.cxx | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index 7f4c2d1..2c98910 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -50,6 +50,8 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, if(this->TestGenerated) { cmTest* test = this->Test; + cmMakefile* mf = test->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); std::ostream& fout = os; cmPropertyMap::const_iterator pit; cmPropertyMap* mpit = &test->GetProperties(); @@ -58,36 +60,8 @@ void cmTestGenerator::GenerateScriptConfigs(std::ostream& os, fout << "SET_TESTS_PROPERTIES(" << test->GetName() << " PROPERTIES "; for ( pit = mpit->begin(); pit != mpit->end(); ++ pit ) { - fout << " " << pit->first.c_str() << " \""; - const char* value = pit->second.GetValue(); - for ( ; *value; ++ value ) - { - switch ( *value ) - { - case '\\': - case '"': - case ' ': - case '#': - case '(': - case ')': - case '$': - case '^': - fout << "\\" << *value; - break; - case '\t': - fout << "\\t"; - break; - case '\n': - fout << "\\n"; - break; - case '\r': - fout << "\\r"; - break; - default: - fout << *value; - } - } - fout << "\""; + fout << " " << pit->first + << " " << lg->EscapeForCMake(pit->second.GetValue()); } fout << ")" << std::endl; } -- cgit v0.12