From 78105444f1856e725a472936d8f9089a0b44a424 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 8 May 2019 10:46:19 +0200 Subject: [PATCH 1/2] Test parsing: Don't use magic numbers --- test/TestCase.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/TestCase.cpp b/test/TestCase.cpp index b4260e436..c86635735 100644 --- a/test/TestCase.cpp +++ b/test/TestCase.cpp @@ -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); From 85b67d3820cc67b771014794847c3adc1ad6da1c Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Wed, 8 May 2019 10:46:38 +0200 Subject: [PATCH 2/2] Fix wrong test settings --- test/libsolidity/semanticTests/viaYul/function_entry_checks.sol | 2 +- test/libsolidity/semanticTests/viaYul/virtual_functions.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol b/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol index 3c224032d..4343419cc 100644 --- a/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol +++ b/test/libsolidity/semanticTests/viaYul/function_entry_checks.sol @@ -16,7 +16,7 @@ contract C { function t(uint) public pure { } } -// === +// ==== // compileViaYul: true // ---- // f() -> 0 diff --git a/test/libsolidity/semanticTests/viaYul/virtual_functions.sol b/test/libsolidity/semanticTests/viaYul/virtual_functions.sol index 38d8b8f87..4ca58e587 100644 --- a/test/libsolidity/semanticTests/viaYul/virtual_functions.sol +++ b/test/libsolidity/semanticTests/viaYul/virtual_functions.sol @@ -23,7 +23,7 @@ contract C is X { x = 3; } } -// === +// ==== // compileViaYul: true // ---- // f() -> 3