Change natspec/abi JSON expected message to be the same

This commit is contained in:
Alex Beregszaszi 2016-11-15 17:37:18 +00:00
parent 81c50143f2
commit 227f6aab4f
2 changed files with 6 additions and 5 deletions

View File

@ -40,12 +40,14 @@ public:
void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString)
{ {
ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse("pragma solidity >=0.0;\n" + _code), "Parsing contract failed"); ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse("pragma solidity >=0.0;\n" + _code), "Parsing contract failed");
Json::Value generatedInterface = m_compilerStack.metadata("", DocumentationType::ABIInterface); Json::Value generatedInterface = m_compilerStack.metadata("", DocumentationType::ABIInterface);
Json::Value expectedInterface; Json::Value expectedInterface;
m_reader.parse(_expectedInterfaceString, expectedInterface); m_reader.parse(_expectedInterfaceString, expectedInterface);
BOOST_CHECK_MESSAGE( BOOST_CHECK_MESSAGE(
expectedInterface == generatedInterface, expectedInterface == generatedInterface,
"Expected:\n" << expectedInterface.toStyledString() << "\n but got:\n" << generatedInterface.toStyledString() "Expected:\n" << expectedInterface.toStyledString() <<
"\n but got:\n" << generatedInterface.toStyledString()
); );
} }

View File

@ -26,7 +26,6 @@
#include <libsolidity/interface/CompilerStack.h> #include <libsolidity/interface/CompilerStack.h>
#include <libsolidity/interface/Exceptions.h> #include <libsolidity/interface/Exceptions.h>
#include <libdevcore/Exceptions.h> #include <libdevcore/Exceptions.h>
#include <libdevcore/JSON.h>
namespace dev namespace dev
{ {
@ -46,9 +45,9 @@ public:
bool _userDocumentation bool _userDocumentation
) )
{ {
Json::Value generatedDocumentation;
ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse("pragma solidity >=0.0;\n" + _code), "Parsing failed"); ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse("pragma solidity >=0.0;\n" + _code), "Parsing failed");
Json::Value generatedDocumentation;
if (_userDocumentation) if (_userDocumentation)
generatedDocumentation = m_compilerStack.metadata("", DocumentationType::NatspecUser); generatedDocumentation = m_compilerStack.metadata("", DocumentationType::NatspecUser);
else else
@ -57,8 +56,8 @@ public:
m_reader.parse(_expectedDocumentationString, expectedDocumentation); m_reader.parse(_expectedDocumentationString, expectedDocumentation);
BOOST_CHECK_MESSAGE( BOOST_CHECK_MESSAGE(
expectedDocumentation == generatedDocumentation, expectedDocumentation == generatedDocumentation,
"Expected " << _expectedDocumentationString << "Expected " << expectedDocumentation.toStyledString() <<
"\n but got:\n" << dev::jsonPrettyPrint(generatedDocumentation) "\n but got:\n" << generatedDocumentation.toStyledString()
); );
} }