From 075715cf151669058251c78b47c0b94fc913e74a Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Tue, 18 Jul 2017 14:34:22 +0100 Subject: Do not use obscure CompilerStack methods in tests --- test/libsolidity/GasMeter.cpp | 4 +++- test/libsolidity/Metadata.cpp | 4 +++- test/libsolidity/SolidityABIJSON.cpp | 4 +++- test/libsolidity/SolidityNatspecJSON.cpp | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp index ef560b12..704ae855 100644 --- a/test/libsolidity/GasMeter.cpp +++ b/test/libsolidity/GasMeter.cpp @@ -47,7 +47,9 @@ public: GasMeterTestFramework() { } void compile(string const& _sourceCode) { - m_compiler.setSource("pragma solidity >= 0.0;" + _sourceCode); + m_compiler.reset(false); + m_compiler.addSource("", "pragma solidity >=0.0;\n" + _sourceCode); + /// NOTE: compiles without optimisations ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(), "Compiling contract failed"); AssemblyItems const* items = m_compiler.runtimeAssemblyItems(""); diff --git a/test/libsolidity/Metadata.cpp b/test/libsolidity/Metadata.cpp index 60bb2e4e..32cf910b 100644 --- a/test/libsolidity/Metadata.cpp +++ b/test/libsolidity/Metadata.cpp @@ -43,7 +43,9 @@ BOOST_AUTO_TEST_CASE(metadata_stamp) } )"; CompilerStack compilerStack; - BOOST_REQUIRE(compilerStack.compile(std::string(sourceCode))); + compilerStack.addSource("", std::string(sourceCode)); + /// NOTE: compiles without optimisations + ETH_TEST_REQUIRE_NO_THROW(compilerStack.compile(), "Compiling contract failed"); bytes const& bytecode = compilerStack.runtimeObject("test").bytecode; std::string const& metadata = compilerStack.onChainMetadata("test"); BOOST_CHECK(dev::test::isValidMetadata(metadata)); diff --git a/test/libsolidity/SolidityABIJSON.cpp b/test/libsolidity/SolidityABIJSON.cpp index f87390e1..452a2662 100644 --- a/test/libsolidity/SolidityABIJSON.cpp +++ b/test/libsolidity/SolidityABIJSON.cpp @@ -42,7 +42,9 @@ public: void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString) { - ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parseAndAnalyze("pragma solidity >=0.0;\n" + _code), "Parsing contract failed"); + m_compilerStack.reset(false); + m_compilerStack.addSource("", "pragma solidity >=0.0;\n" + _code); + ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parseAndAnalyze(), "Parsing contract failed"); Json::Value generatedInterface = m_compilerStack.contractABI(""); Json::Value expectedInterface; diff --git a/test/libsolidity/SolidityNatspecJSON.cpp b/test/libsolidity/SolidityNatspecJSON.cpp index 2a7376b9..aa343561 100644 --- a/test/libsolidity/SolidityNatspecJSON.cpp +++ b/test/libsolidity/SolidityNatspecJSON.cpp @@ -45,7 +45,9 @@ public: bool _userDocumentation ) { - ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parseAndAnalyze("pragma solidity >=0.0;\n" + _code), "Parsing failed"); + m_compilerStack.reset(false); + m_compilerStack.addSource("", "pragma solidity >=0.0;\n" + _code); + ETH_TEST_REQUIRE_NO_THROW(m_compilerStack.parseAndAnalyze(), "Parsing contract failed"); Json::Value generatedDocumentation; if (_userDocumentation) -- cgit