MXS-1196: Handle eol-comments

Eol-comments need to be followed by a newline as otherwise the
rest of a test-statement will be excluded.
This commit is contained in:
Johan Wikman
2017-05-24 08:59:39 +03:00
parent 332e1bbb7c
commit eaf5a4152b

View File

@ -290,6 +290,28 @@ TestReader::result_t TestReader::get_statement(std::string& stmt)
stmt += line; stmt += line;
// Look for a ';'. If we are dealing with a one line test statment
// the delimiter will in practice be ';' and if it is a multi-line
// test statement then the test-script delimiter will be something
// else than ';' and ';' will be the delimiter used in the multi-line
// statement.
string::size_type i = line.find(";");
if (i != string::npos)
{
// Is there a "-- " or "#" after the delimiter?
if ((line.find("-- ", i) != string::npos) ||
(line.find("#", i) != string::npos))
{
// If so, add a newline. Otherwise the rest of the
// statement would be included in the comment.
stmt += "\n";
}
// This is somewhat fragile as a ";", "#" or "-- " inside a
// string will trigger this behaviour...
}
string c; string c;
if (line.length() >= m_delimiter.length()) if (line.length() >= m_delimiter.length())