mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Test parsing: Don't use magic numbers
This commit is contained in:
parent
2370eefa74
commit
78105444f1
@ -66,6 +66,7 @@ string TestCase::parseSourceAndSettings(istream& _stream)
|
||||
{
|
||||
string source;
|
||||
string line;
|
||||
static string const comment("// ");
|
||||
static string const settingsDelimiter("// ====");
|
||||
static string const delimiter("// ----");
|
||||
bool sourcePart = true;
|
||||
@ -77,12 +78,12 @@ string TestCase::parseSourceAndSettings(istream& _stream)
|
||||
sourcePart = false;
|
||||
else if (sourcePart)
|
||||
source += line + "\n";
|
||||
else if (boost::algorithm::starts_with(line, "// "))
|
||||
else if (boost::algorithm::starts_with(line, comment))
|
||||
{
|
||||
size_t colon = line.find(':');
|
||||
if (colon == string::npos)
|
||||
throw runtime_error(string("Expected \":\" inside setting."));
|
||||
string key = line.substr(3, colon - 3);
|
||||
string key = line.substr(comment.size(), colon - comment.size());
|
||||
string value = line.substr(colon + 1);
|
||||
boost::algorithm::trim(key);
|
||||
boost::algorithm::trim(value);
|
||||
|
Loading…
Reference in New Issue
Block a user