Make TrimComment call TrimSpace
parent
de75959fd7
commit
05f053007b
25
datatest.cpp
25
datatest.cpp
|
|
@ -51,18 +51,6 @@ public:
|
||||||
|
|
||||||
static const TestData *s_currentTestData = NULLPTR;
|
static const TestData *s_currentTestData = NULLPTR;
|
||||||
|
|
||||||
std::string TrimComment(std::string str)
|
|
||||||
{
|
|
||||||
if (str.empty()) return "";
|
|
||||||
|
|
||||||
std::string::size_type first = str.find("#");
|
|
||||||
|
|
||||||
if (first != std::string::npos)
|
|
||||||
return str.substr(0, first);
|
|
||||||
else
|
|
||||||
return str;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string TrimSpace(std::string str)
|
std::string TrimSpace(std::string str)
|
||||||
{
|
{
|
||||||
if (str.empty()) return "";
|
if (str.empty()) return "";
|
||||||
|
|
@ -79,6 +67,18 @@ std::string TrimSpace(std::string str)
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string TrimComment(std::string str)
|
||||||
|
{
|
||||||
|
if (str.empty()) return "";
|
||||||
|
|
||||||
|
std::string::size_type first = str.find("#");
|
||||||
|
|
||||||
|
if (first != std::string::npos)
|
||||||
|
return TrimSpace(str.substr(0, first));
|
||||||
|
else
|
||||||
|
return TrimSpace(str);
|
||||||
|
}
|
||||||
|
|
||||||
static void OutputTestData(const TestData &v)
|
static void OutputTestData(const TestData &v)
|
||||||
{
|
{
|
||||||
std::cerr << "\n";
|
std::cerr << "\n";
|
||||||
|
|
@ -865,7 +865,6 @@ bool GetField(std::istream &is, std::string &name, std::string &value)
|
||||||
|
|
||||||
// Re-trim after parsing
|
// Re-trim after parsing
|
||||||
line = TrimComment(line);
|
line = TrimComment(line);
|
||||||
line = TrimSpace(line);
|
|
||||||
|
|
||||||
if (line.empty())
|
if (line.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue