Minor adjustments.

This commit is contained in:
Daniel Kirchner 2018-03-13 12:30:56 +01:00
parent 3232561d97
commit 7091b6c8b5

View File

@ -48,7 +48,7 @@ SyntaxTest::SyntaxTest(string const& _filename)
{ {
ifstream file(_filename); ifstream file(_filename);
if (!file) if (!file)
BOOST_THROW_EXCEPTION(runtime_error("cannot open test contract: \"" + _filename + "\"")); BOOST_THROW_EXCEPTION(runtime_error("Cannot open test contract: \"" + _filename + "\"."));
file.exceptions(ios::badbit); file.exceptions(ios::badbit);
m_source = parseSource(file); m_source = parseSource(file);
@ -60,7 +60,7 @@ bool SyntaxTest::run(ostream& _stream, string const& _indent)
m_errorList = parseAnalyseAndReturnError(m_source, true, true, true).second; m_errorList = parseAnalyseAndReturnError(m_source, true, true, true).second;
if (!matchesExpectations(m_errorList)) if (!matchesExpectations(m_errorList))
{ {
std::string nextIndentLevel = _indent.empty() ? "\t" : _indent + _indent; std::string nextIndentLevel = _indent + "\t";
_stream << _indent << "Expected result:" << endl; _stream << _indent << "Expected result:" << endl;
printExpected(_stream, nextIndentLevel); printExpected(_stream, nextIndentLevel);
_stream << _indent << "Obtained result:\n"; _stream << _indent << "Obtained result:\n";
@ -99,8 +99,8 @@ bool SyntaxTest::matchesExpectations(ErrorList const& _errorList) const
else else
for (size_t i = 0; i < _errorList.size(); i++) for (size_t i = 0; i < _errorList.size(); i++)
if ( if (
!(_errorList[i]->typeName() == m_expectations[i].type) || (_errorList[i]->typeName() != m_expectations[i].type) ||
!(errorMessage(*_errorList[i]) == m_expectations[i].message) (errorMessage(*_errorList[i]) != m_expectations[i].message)
) )
return false; return false;
return true; return true;