mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use same multi-source-syntax for test files
This commit is contained in:
parent
3817515015
commit
a1eb0f7225
@ -1,14 +1,14 @@
|
|||||||
// ---- SOURCE: a
|
==== Source: a ====
|
||||||
|
|
||||||
/**This contract is empty*/ contract C {}
|
/**This contract is empty*/ contract C {}
|
||||||
|
|
||||||
// ---- SOURCE: b
|
==== Source: b ====
|
||||||
|
|
||||||
/**This contract is empty
|
/**This contract is empty
|
||||||
and has a line-breaking comment.*/
|
and has a line-breaking comment.*/
|
||||||
contract C {}
|
contract C {}
|
||||||
|
|
||||||
// ---- SOURCE: c
|
==== Source: c ====
|
||||||
|
|
||||||
contract C {
|
contract C {
|
||||||
/** Some comment on state var.*/ uint public state;
|
/** Some comment on state var.*/ uint public state;
|
||||||
|
@ -44,6 +44,8 @@ using namespace boost::unit_test;
|
|||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
|
||||||
|
string const sourceDelimiter("==== Source: ");
|
||||||
|
|
||||||
void replaceVersionWithTag(string& _input)
|
void replaceVersionWithTag(string& _input)
|
||||||
{
|
{
|
||||||
boost::algorithm::replace_all(
|
boost::algorithm::replace_all(
|
||||||
@ -81,7 +83,6 @@ ASTJSONTest::ASTJSONTest(string const& _filename)
|
|||||||
string sourceName;
|
string sourceName;
|
||||||
string source;
|
string source;
|
||||||
string line;
|
string line;
|
||||||
string const sourceDelimiter("// ---- SOURCE: ");
|
|
||||||
string const delimiter("// ----");
|
string const delimiter("// ----");
|
||||||
while (getline(file, line))
|
while (getline(file, line))
|
||||||
{
|
{
|
||||||
@ -90,7 +91,10 @@ ASTJSONTest::ASTJSONTest(string const& _filename)
|
|||||||
if (!sourceName.empty())
|
if (!sourceName.empty())
|
||||||
m_sources.emplace_back(sourceName, source);
|
m_sources.emplace_back(sourceName, source);
|
||||||
|
|
||||||
sourceName = line.substr(sourceDelimiter.size(), string::npos);
|
sourceName = line.substr(
|
||||||
|
sourceDelimiter.size(),
|
||||||
|
line.size() - " ===="s.size() - sourceDelimiter.size()
|
||||||
|
);
|
||||||
source = string();
|
source = string();
|
||||||
}
|
}
|
||||||
else if (!line.empty() && !boost::algorithm::starts_with(line, delimiter))
|
else if (!line.empty() && !boost::algorithm::starts_with(line, delimiter))
|
||||||
@ -238,7 +242,7 @@ void ASTJSONTest::printSource(ostream& _stream, string const& _linePrefix, bool
|
|||||||
for (auto const& source: m_sources)
|
for (auto const& source: m_sources)
|
||||||
{
|
{
|
||||||
if (m_sources.size() > 1 || source.first != "a")
|
if (m_sources.size() > 1 || source.first != "a")
|
||||||
_stream << _linePrefix << "// ---- SOURCE: " << source.first << endl << endl;
|
_stream << _linePrefix << sourceDelimiter << source.first << endl << endl;
|
||||||
stringstream stream(source.second);
|
stringstream stream(source.second);
|
||||||
string line;
|
string line;
|
||||||
while (getline(stream, line))
|
while (getline(stream, line))
|
||||||
|
Loading…
Reference in New Issue
Block a user