summaryrefslogtreecommitdiffstats
path: root/Source/cmAddTestCommand.cxx
diff options
context:
space:
mode:
authorAsit Dhal <dhal.asitk@gmail.com>2019-09-15 17:11:02 (GMT)
committerBrad King <brad.king@kitware.com>2019-09-18 18:18:46 (GMT)
commit9dba84cfa5e85e51ee6d6799f03a26656063ef8b (patch)
tree22fb29536def399e2ab763ac202a52467d45d7e2 /Source/cmAddTestCommand.cxx
parent1423507a71199fd76b457ad9b215a6caca70ee58 (diff)
downloadCMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.zip
CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.tar.gz
CMake-9dba84cfa5e85e51ee6d6799f03a26656063ef8b.tar.bz2
Refactor: Use cmStrCat to construct error strings
Replace string construction using std::stringstream with cmStrCat and cmWrap.
Diffstat (limited to 'Source/cmAddTestCommand.cxx')
-rw-r--r--Source/cmAddTestCommand.cxx19
1 files changed, 6 insertions, 13 deletions
diff --git a/Source/cmAddTestCommand.cxx b/Source/cmAddTestCommand.cxx
index 7904bf5..8942113 100644
--- a/Source/cmAddTestCommand.cxx
+++ b/Source/cmAddTestCommand.cxx
@@ -2,10 +2,9 @@
file Copyright.txt or https://cmake.org/licensing for details. */
#include "cmAddTestCommand.h"
-#include <sstream>
-
#include "cmExecutionStatus.h"
#include "cmMakefile.h"
+#include "cmStringAlgorithms.h"
#include "cmTest.h"
#include "cmTestGenerator.h"
@@ -38,10 +37,8 @@ bool cmAddTestCommand(std::vector<std::string> const& args,
// If the test was already added by a new-style signature do not
// allow it to be duplicated.
if (!test->GetOldStyle()) {
- std::ostringstream e;
- e << " given test name \"" << args[0]
- << "\" which already exists in this directory.";
- status.SetError(e.str());
+ status.SetError(cmStrCat(" given test name \"", args[0],
+ "\" which already exists in this directory."));
return false;
}
} else {
@@ -110,9 +107,7 @@ bool cmAddTestCommandHandleNameMode(std::vector<std::string> const& args,
working_directory = args[i];
doing = DoingNone;
} else {
- std::ostringstream e;
- e << " given unknown argument:\n " << args[i] << "\n";
- status.SetError(e.str());
+ status.SetError(cmStrCat(" given unknown argument:\n ", args[i], "\n"));
return false;
}
}
@@ -133,10 +128,8 @@ bool cmAddTestCommandHandleNameMode(std::vector<std::string> const& args,
// Require a unique test name within the directory.
if (mf.GetTest(name)) {
- std::ostringstream e;
- e << " given test NAME \"" << name
- << "\" which already exists in this directory.";
- status.SetError(e.str());
+ status.SetError(cmStrCat(" given test NAME \"", name,
+ "\" which already exists in this directory."));
return false;
}