Skip to content

Commit

Permalink
Do not use obscure CompilerStack methods in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Jul 18, 2017
1 parent 0eab808 commit 075715c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
4 changes: 3 additions & 1 deletion test/libsolidity/GasMeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ class GasMeterTestFramework: public SolidityExecutionFramework
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("");
Expand Down
4 changes: 3 additions & 1 deletion test/libsolidity/Metadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 3 additions & 1 deletion test/libsolidity/SolidityABIJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ class JSONInterfaceChecker

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;
Expand Down
4 changes: 3 additions & 1 deletion test/libsolidity/SolidityNatspecJSON.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class DocumentationChecker
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)
Expand Down

0 comments on commit 075715c

Please sign in to comment.