diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2014-12-02 17:41:18 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2014-12-02 17:41:18 +0800 |
commit | 92724ab80a713332d711fe43a5a09332d9d2d9e4 (patch) | |
tree | eb11e2155937b55c19922b0d4cf24c3f632fb086 /solidityJSONInterfaceTest.cpp | |
parent | bbf4beab45e4e4a8b02bbf5736e8667c2667f815 (diff) | |
download | dexon-solidity-92724ab80a713332d711fe43a5a09332d9d2d9e4.tar.gz dexon-solidity-92724ab80a713332d711fe43a5a09332d9d2d9e4.tar.zst dexon-solidity-92724ab80a713332d711fe43a5a09332d9d2d9e4.zip |
More Natspec JSON export tests and better error reporting
Diffstat (limited to 'solidityJSONInterfaceTest.cpp')
-rw-r--r-- | solidityJSONInterfaceTest.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/solidityJSONInterfaceTest.cpp b/solidityJSONInterfaceTest.cpp index b9188013..f46a3ad3 100644 --- a/solidityJSONInterfaceTest.cpp +++ b/solidityJSONInterfaceTest.cpp @@ -23,6 +23,7 @@ #include <boost/test/unit_test.hpp> #include <libsolidity/CompilerStack.h> #include <jsonrpc/json/json.h> +#include <libdevcore/Exceptions.h> namespace dev { @@ -36,7 +37,19 @@ class InterfaceChecker public: void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) { - m_compilerStack.parse(_code); + try + { + m_compilerStack.parse(_code); + } + catch (const std::exception& e) + { + std::string const* extra = boost::get_error_info<errinfo_comment>(e); + std::string msg = std::string("Parsing contract failed with: ") + + e.what() + std::string("\n"); + if (extra) + msg += *extra; + BOOST_FAIL(msg); + } std::string generatedInterfaceString = m_compilerStack.getInterface(); Json::Value generatedInterface; m_reader.parse(generatedInterfaceString, generatedInterface); @@ -52,7 +65,7 @@ private: Json::Reader m_reader; }; -BOOST_FIXTURE_TEST_SUITE(solidityABIJSON, InterfaceChecker) +BOOST_FIXTURE_TEST_SUITE(SolidityABIJSON, InterfaceChecker) BOOST_AUTO_TEST_CASE(basic_test) { |