mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #9793 from ethereum/same-syntax-test
[Trivial] Use same multi-source-syntax for test files
This commit is contained in:
		
						commit
						9eda69f637
					
				| @ -1,14 +1,14 @@ | ||||
| // ---- SOURCE: a | ||||
| ==== Source: a ==== | ||||
| 
 | ||||
| /**This contract is empty*/ contract C {} | ||||
| 
 | ||||
| // ---- SOURCE: b | ||||
| ==== Source: b ==== | ||||
| 
 | ||||
| /**This contract is empty | ||||
|  and has a line-breaking comment.*/ | ||||
| contract C {} | ||||
| 
 | ||||
| // ---- SOURCE: c | ||||
| ==== Source: c ==== | ||||
| 
 | ||||
| contract C { | ||||
|   /** Some comment on state var.*/ uint public state; | ||||
|  | ||||
| @ -44,6 +44,8 @@ using namespace boost::unit_test; | ||||
| namespace | ||||
| { | ||||
| 
 | ||||
| string const sourceDelimiter("==== Source: "); | ||||
| 
 | ||||
| void replaceVersionWithTag(string& _input) | ||||
| { | ||||
| 	boost::algorithm::replace_all( | ||||
| @ -81,7 +83,6 @@ ASTJSONTest::ASTJSONTest(string const& _filename) | ||||
| 	string sourceName; | ||||
| 	string source; | ||||
| 	string line; | ||||
| 	string const sourceDelimiter("// ---- SOURCE: "); | ||||
| 	string const delimiter("// ----"); | ||||
| 	while (getline(file, line)) | ||||
| 	{ | ||||
| @ -90,7 +91,10 @@ ASTJSONTest::ASTJSONTest(string const& _filename) | ||||
| 			if (!sourceName.empty()) | ||||
| 				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(); | ||||
| 		} | ||||
| 		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) | ||||
| 	{ | ||||
| 		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); | ||||
| 		string line; | ||||
| 		while (getline(stream, line)) | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user