mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2585 from ethereum/tests-compilerstack
Do not use obscure CompilerStack methods in tests
This commit is contained in:
commit
01fbc63623
@ -47,7 +47,9 @@ public:
|
|||||||
GasMeterTestFramework() { }
|
GasMeterTestFramework() { }
|
||||||
void compile(string const& _sourceCode)
|
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");
|
ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(), "Compiling contract failed");
|
||||||
|
|
||||||
AssemblyItems const* items = m_compiler.runtimeAssemblyItems("");
|
AssemblyItems const* items = m_compiler.runtimeAssemblyItems("");
|
||||||
|
@ -43,7 +43,9 @@ BOOST_AUTO_TEST_CASE(metadata_stamp)
|
|||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
CompilerStack compilerStack;
|
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;
|
bytes const& bytecode = compilerStack.runtimeObject("test").bytecode;
|
||||||
std::string const& metadata = compilerStack.onChainMetadata("test");
|
std::string const& metadata = compilerStack.onChainMetadata("test");
|
||||||
BOOST_CHECK(dev::test::isValidMetadata(metadata));
|
BOOST_CHECK(dev::test::isValidMetadata(metadata));
|
||||||
|
@ -42,7 +42,9 @@ public:
|
|||||||
|
|
||||||
void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString)
|
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 generatedInterface = m_compilerStack.contractABI("");
|
||||||
Json::Value expectedInterface;
|
Json::Value expectedInterface;
|
||||||
|
@ -45,7 +45,9 @@ public:
|
|||||||
bool _userDocumentation
|
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;
|
Json::Value generatedDocumentation;
|
||||||
if (_userDocumentation)
|
if (_userDocumentation)
|
||||||
|
Loading…
Reference in New Issue
Block a user