Unify parsing of simple test expectations and require lines to start with `//`.

This commit is contained in:
Daniel Kirchner
2019-06-11 14:05:45 +02:00
parent bd1f65d609
commit 547173533c
5 changed files with 19 additions and 18 deletions
+14
View File
@@ -95,6 +95,20 @@ string TestCase::parseSourceAndSettings(istream& _stream)
return source;
}
string TestCase::parseSimpleExpectations(std::istream& _file)
{
string result;
string line;
while (getline(_file, line))
if (boost::algorithm::starts_with(line, "// "))
result += line.substr(3) + "\n";
else if (line == "//")
result += "\n";
else
BOOST_THROW_EXCEPTION(runtime_error("Test expectations must start with \"// \"."));
return result;
}
void TestCase::expect(string::iterator& _it, string::iterator _end, string::value_type _c)
{
if (_it == _end || *_it != _c)