aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-09-11 21:19:58 +0800
committerchriseth <c@ethdev.com>2015-09-11 21:19:58 +0800
commitc5b6d9d2a9fb379e35435726046ce6c551d25c17 (patch)
tree40c03e362e723a874aa42f84fd1a5ab528e6f128 /test
parentfbfa99b4734c15fadad9c439c2c7a340b2a444d0 (diff)
parentd570ab44c893972dfc4541d4970ec9a172e28096 (diff)
downloaddexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar.gz
dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar.zst
dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.zip
Merge pull request #65 from LianaHus/sol_Creating_a_contract_from_within_itself
Added error when creating a contract from within itself
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 9f352b36..883d7807 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2194,6 +2194,18 @@ BOOST_AUTO_TEST_CASE(string_bytes_conversion)
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
+
+BOOST_AUTO_TEST_CASE(creating_contract_within_the_contract)
+{
+ char const* sourceCode = R"(
+ contract Test {
+ function f() { var x = new Test(); }
+ }
+ )";
+
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}