From 9205662de9416ab160db7327a6022ea8b1fba3e1 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 15 Nov 2016 17:20:24 +0000 Subject: Update tests to use JSON --- test/libsolidity/SolidityNatspecJSON.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'test/libsolidity/SolidityNatspecJSON.cpp') diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 1f74e928..facfcda7 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -45,21 +45,19 @@ public: bool _userDocumentation ) { - std::string generatedDocumentationString; + Json::Value generatedDocumentation; ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse("pragma solidity >=0.0;\n" + _code), "Parsing failed"); if (_userDocumentation) - generatedDocumentationString = m_compilerStack.metadata("", DocumentationType::NatspecUser); + generatedDocumentation = m_compilerStack.metadata("", DocumentationType::NatspecUser); else - generatedDocumentationString = m_compilerStack.metadata("", DocumentationType::NatspecDev); - Json::Value generatedDocumentation; - m_reader.parse(generatedDocumentationString, generatedDocumentation); + generatedDocumentation = m_compilerStack.metadata("", DocumentationType::NatspecDev); Json::Value expectedDocumentation; m_reader.parse(_expectedDocumentationString, expectedDocumentation); BOOST_CHECK_MESSAGE( expectedDocumentation == generatedDocumentation, "Expected " << _expectedDocumentationString << - "\n but got:\n" << generatedDocumentationString + "\n but got:\n" << Json::StyledWriter().write(generatedDocumentation) ); } -- cgit v1.2.3 From 81c50143f2bff6f589ab1237d68c8820107f18b9 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 15 Nov 2016 17:33:28 +0000 Subject: Move JSON helpers to libdevcore/json --- test/libsolidity/SolidityNatspecJSON.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/libsolidity/SolidityNatspecJSON.cpp') diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index facfcda7..f05542b1 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -26,6 +26,7 @@ #include #include #include +#include namespace dev { @@ -57,7 +58,7 @@ public: BOOST_CHECK_MESSAGE( expectedDocumentation == generatedDocumentation, "Expected " << _expectedDocumentationString << - "\n but got:\n" << Json::StyledWriter().write(generatedDocumentation) + "\n but got:\n" << dev::jsonPrettyPrint(generatedDocumentation) ); } -- cgit v1.2.3 From 227f6aab4f96003e0f7c99194a9ea1095041970f Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 15 Nov 2016 17:37:18 +0000 Subject: Change natspec/abi JSON expected message to be the same --- test/libsolidity/SolidityNatspecJSON.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'test/libsolidity/SolidityNatspecJSON.cpp') diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index f05542b1..49844f15 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -26,7 +26,6 @@ #include #include #include -#include namespace dev { @@ -46,9 +45,9 @@ public: bool _userDocumentation ) { - Json::Value generatedDocumentation; ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parse("pragma solidity >=0.0;\n" + _code), "Parsing failed"); + Json::Value generatedDocumentation; if (_userDocumentation) generatedDocumentation = m_compilerStack.metadata("", DocumentationType::NatspecUser); else @@ -57,8 +56,8 @@ public: m_reader.parse(_expectedDocumentationString, expectedDocumentation); BOOST_CHECK_MESSAGE( expectedDocumentation == generatedDocumentation, - "Expected " << _expectedDocumentationString << - "\n but got:\n" << dev::jsonPrettyPrint(generatedDocumentation) + "Expected " << expectedDocumentation.toStyledString() << + "\n but got:\n" << generatedDocumentation.toStyledString() ); } -- cgit v1.2.3