diff options
author | chriseth <c@ethdev.com> | 2016-08-06 19:27:29 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-08-12 21:11:31 +0800 |
commit | 61e94940bc6dd916408a73b0510a81ac2c75c932 (patch) | |
tree | 1798863b966705120d327572ac6492dcf387fd27 /test/libsolidity | |
parent | b9f5b675a664ebdb1b28b87271783c59341ef3f1 (diff) | |
download | dexon-solidity-61e94940bc6dd916408a73b0510a81ac2c75c932.tar.gz dexon-solidity-61e94940bc6dd916408a73b0510a81ac2c75c932.tar.zst dexon-solidity-61e94940bc6dd916408a73b0510a81ac2c75c932.zip |
Show compilation errors in tests.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityExecutionFramework.h | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityExecutionFramework.h b/test/libsolidity/SolidityExecutionFramework.h index 5764784a..c34b00ec 100644 --- a/test/libsolidity/SolidityExecutionFramework.h +++ b/test/libsolidity/SolidityExecutionFramework.h @@ -33,6 +33,7 @@ #include <libsolidity/interface/CompilerStack.h> #include <libsolidity/interface/Exceptions.h> +#include <libsolidity/interface/SourceReferenceFormatter.h> namespace dev { @@ -68,7 +69,17 @@ public: { m_compiler.reset(false, m_addStandardSources); m_compiler.addSource("", _sourceCode); - ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); + if (!m_compiler.compile(m_optimize, m_optimizeRuns)) + { + for (auto const& error: m_compiler.errors()) + SourceReferenceFormatter::printExceptionInformation( + std::cerr, + *error, + (error->type() == Error::Type::Warning) ? "Warning" : "Error", + [&](std::string const& _sourceName) -> solidity::Scanner const& { return m_compiler.scanner(_sourceName); } + ); + BOOST_ERROR("Compiling contract failed"); + } eth::LinkerObject obj = m_compiler.object(_contractName); obj.link(_libraryAddresses); BOOST_REQUIRE(obj.linkReferences.empty()); |