diff options
author | chriseth <c@ethdev.com> | 2015-09-11 21:19:58 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-09-11 21:19:58 +0800 |
commit | c5b6d9d2a9fb379e35435726046ce6c551d25c17 (patch) | |
tree | 40c03e362e723a874aa42f84fd1a5ab528e6f128 /test | |
parent | fbfa99b4734c15fadad9c439c2c7a340b2a444d0 (diff) | |
parent | d570ab44c893972dfc4541d4970ec9a172e28096 (diff) | |
download | dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar.gz dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar.bz2 dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar.lz dexon-solidity-c5b6d9d2a9fb379e35435726046ce6c551d25c17.tar.xz 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.cpp | 12 |
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() } |