MXS-1196: Allow delimiters to be multi-character
In some new test files, the delimiter is 2 characters.
This commit is contained in:
@ -193,7 +193,7 @@ TestReader::TestReader(istream& in,
|
|||||||
size_t line)
|
size_t line)
|
||||||
: m_in(in)
|
: m_in(in)
|
||||||
, m_line(line)
|
, m_line(line)
|
||||||
, m_delimiter(';')
|
, m_delimiter(";")
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -244,7 +244,7 @@ TestReader::result_t TestReader::get_statement(std::string& stmt)
|
|||||||
trim(line);
|
trim(line);
|
||||||
if (line.length() > 0)
|
if (line.length() > 0)
|
||||||
{
|
{
|
||||||
m_delimiter = line.at(0);
|
m_delimiter = line;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -268,15 +268,20 @@ TestReader::result_t TestReader::get_statement(std::string& stmt)
|
|||||||
|
|
||||||
stmt += line;
|
stmt += line;
|
||||||
|
|
||||||
char c = line.at(line.length() - 1);
|
string c;
|
||||||
|
|
||||||
|
if (line.length() >= m_delimiter.length())
|
||||||
|
{
|
||||||
|
c = line.substr(line.length() - m_delimiter.length());
|
||||||
|
}
|
||||||
|
|
||||||
if (c == m_delimiter)
|
if (c == m_delimiter)
|
||||||
{
|
{
|
||||||
if (c != ';')
|
if (c != ";")
|
||||||
{
|
{
|
||||||
// If the delimiter was something else but ';' we need to
|
// If the delimiter was something else but ';' we need to
|
||||||
// remove that before giving the line to the classifiers.
|
// remove that before giving the line to the classifiers.
|
||||||
stmt.erase(stmt.length() - 1);
|
stmt.erase(stmt.length() - m_delimiter.length());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!skip)
|
if (!skip)
|
||||||
|
@ -76,7 +76,7 @@ private:
|
|||||||
private:
|
private:
|
||||||
std::istream& m_in; /*< The stream we are using. */
|
std::istream& m_in; /*< The stream we are using. */
|
||||||
size_t m_line; /*< The current line. */
|
size_t m_line; /*< The current line. */
|
||||||
char m_delimiter; /*< The current delimiter. */
|
std::string m_delimiter; /*< The current delimiter. */
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user