From 41fb6f4ff8a303743b800f2797eb9a95a5a0dced Mon Sep 17 00:00:00 2001 From: Erik Kundt Date: Sat, 13 Jul 2019 14:02:20 +0200 Subject: [PATCH] isoltest: Removes additional whitespaces from output. --- test/libsolidity/util/TestFileParser.cpp | 6 ++--- test/libsolidity/util/TestFunctionCall.cpp | 26 +++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/test/libsolidity/util/TestFileParser.cpp b/test/libsolidity/util/TestFileParser.cpp index ed06483ba..3f5775262 100644 --- a/test/libsolidity/util/TestFileParser.cpp +++ b/test/libsolidity/util/TestFileParser.cpp @@ -86,7 +86,7 @@ vector TestFileParser::parseFunctionCalls(siz call.displayMode = FunctionCall::DisplayMode::MultiLine; m_lineNumber++; } - + call.arguments.comment = parseComment(); if (accept(Token::Newline, true)) @@ -94,13 +94,13 @@ vector TestFileParser::parseFunctionCalls(siz call.displayMode = FunctionCall::DisplayMode::MultiLine; m_lineNumber++; } - + if (accept(Token::Arrow, true)) { call.omitsArrow = false; call.expectations = parseFunctionCallExpectations(); if (accept(Token::Newline, true)) - m_lineNumber++; + m_lineNumber++; } else { diff --git a/test/libsolidity/util/TestFunctionCall.cpp b/test/libsolidity/util/TestFunctionCall.cpp index 9fb70b719..d1168a68a 100644 --- a/test/libsolidity/util/TestFunctionCall.cpp +++ b/test/libsolidity/util/TestFunctionCall.cpp @@ -62,7 +62,7 @@ string TestFunctionCall::format( { string output = formatRawParameters(m_call.arguments.parameters, _linePrefix); stream << colon; - if (_singleLine) + if (!m_call.arguments.parameters.at(0).format.newline) stream << ws; stream << output; @@ -78,12 +78,10 @@ string TestFunctionCall::format( if (m_call.omitsArrow) { if (_renderResult && (m_failure || !matchesExpectation())) - stream << ws << arrow << ws; + stream << ws << arrow; } else - { - stream << ws << arrow << ws; - } + stream << ws << arrow; } else { @@ -93,7 +91,7 @@ string TestFunctionCall::format( stream << comment << m_call.arguments.comment << comment; stream << endl << _linePrefix << newline << ws; } - stream << arrow << ws; + stream << arrow; } /// Format either the expected output or the actual result output @@ -105,7 +103,8 @@ string TestFunctionCall::format( result = isFailure ? failure : formatRawParameters(m_call.expectations.result); - AnsiColorized(stream, highlight, {dev::formatting::RED_BACKGROUND}) << result; + if (!result.empty()) + AnsiColorized(stream, highlight, {dev::formatting::RED_BACKGROUND}) << ws << result; } else { @@ -124,9 +123,11 @@ string TestFunctionCall::format( ); if (isFailure) - AnsiColorized(stream, highlight, {dev::formatting::RED_BACKGROUND}) << result; + AnsiColorized(stream, highlight, {dev::formatting::RED_BACKGROUND}) << ws << result; else - stream << result; + if (!result.empty()) + stream << ws << result; + } /// Format comments on expectations taking the display-mode into account. @@ -292,7 +293,12 @@ string TestFunctionCall::formatRawParameters( os << endl << _linePrefix << "// "; os << param.rawString; if (¶m != &_params.back()) - os << ", "; + { + if (param.format.newline) + os << ","; + else + os << ", "; + } } return os.str(); }