Merge pull request #8979 from ethereum/doc-json

[Trival] Test: Output JSON AST as array when it involves multiple sources
This commit is contained in:
chriseth 2020-05-19 15:29:24 +02:00 committed by GitHub
commit 3211e22045
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,4 @@
[
{ {
"absolutePath": "a", "absolutePath": "a",
"exportedSymbols": "exportedSymbols":
@ -218,3 +219,4 @@
], ],
"src": "0:160:3" "src": "0:160:3"
} }
]

View File

@ -140,6 +140,9 @@ TestCase::TestResult ASTJSONTest::run(ostream& _stream, string const& _linePrefi
return TestResult::FatalError; return TestResult::FatalError;
} }
if (m_sources.size() > 1)
m_result += "[\n";
for (size_t i = 0; i < m_sources.size(); i++) for (size_t i = 0; i < m_sources.size(); i++)
{ {
ostringstream result; ostringstream result;
@ -150,6 +153,9 @@ TestCase::TestResult ASTJSONTest::run(ostream& _stream, string const& _linePrefi
m_result += "\n"; m_result += "\n";
} }
if (m_sources.size() > 1)
m_result += "]\n";
bool resultsMatch = true; bool resultsMatch = true;
replaceTagWithVersion(m_expectation); replaceTagWithVersion(m_expectation);