aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SolidityABIJSON.cpp2
-rw-r--r--SolidityEndToEndTest.cpp15
-rw-r--r--SolidityNatspecJSON.cpp2
-rw-r--r--solidityExecutionFramework.h6
4 files changed, 23 insertions, 2 deletions
diff --git a/SolidityABIJSON.cpp b/SolidityABIJSON.cpp
index 892b71f1..4a44ebb8 100644
--- a/SolidityABIJSON.cpp
+++ b/SolidityABIJSON.cpp
@@ -35,6 +35,8 @@ namespace test
class InterfaceChecker
{
public:
+ InterfaceChecker(): m_compilerStack(false) {}
+
void checkInterface(std::string const& _code, std::string const& _expectedInterfaceString)
{
try
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 97f444d2..23cd4f6d 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -1862,6 +1862,21 @@ BOOST_AUTO_TEST_CASE(function_modifier_for_constructor)
BOOST_CHECK(callContractFunction("getData()") == encodeArgs(4 | 2));
}
+BOOST_AUTO_TEST_CASE(use_std_lib)
+{
+ char const* sourceCode = R"(
+ import "mortal";
+ contract Icarus is mortal { }
+ )";
+ u256 amount(130);
+ u160 address(23);
+ compileAndRun(sourceCode, amount, "Icarus");
+ u256 balanceBefore = m_state.balance(m_sender);
+ BOOST_CHECK(callContractFunction("kill()") == bytes());
+ BOOST_CHECK(!m_state.addressHasCode(m_contractAddress));
+ BOOST_CHECK(m_state.balance(m_sender) > balanceBefore);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}
diff --git a/SolidityNatspecJSON.cpp b/SolidityNatspecJSON.cpp
index 743651d5..911820dd 100644
--- a/SolidityNatspecJSON.cpp
+++ b/SolidityNatspecJSON.cpp
@@ -36,6 +36,8 @@ namespace test
class DocumentationChecker
{
public:
+ DocumentationChecker(): m_compilerStack(false) {}
+
void checkNatspec(std::string const& _code,
std::string const& _expectedDocumentationString,
bool _userDocumentation)
diff --git a/solidityExecutionFramework.h b/solidityExecutionFramework.h
index 271a594c..208e9ae8 100644
--- a/solidityExecutionFramework.h
+++ b/solidityExecutionFramework.h
@@ -45,10 +45,12 @@ public:
bytes const& compileAndRun(std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "")
{
- dev::solidity::CompilerStack compiler;
+ // add standard sources only if contract name is given
+ dev::solidity::CompilerStack compiler(!_contractName.empty());
try
{
- compiler.compile(_sourceCode, m_optimize);
+ compiler.addSource("", _sourceCode);
+ compiler.compile(m_optimize);
}
catch(boost::exception const& _e)
{