diff options
author | LianaHus <liana@ethdev.com> | 2015-09-10 23:17:13 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-09-10 23:17:13 +0800 |
commit | 47e42430f27c579e09157f3373238e3bbe8ab93e (patch) | |
tree | 39fdc6752502ecd44d0f92362f053cf1e1295b63 /test | |
parent | 30e89b3d9a85d7dba3e9858a19b3495e9c8f759a (diff) | |
download | dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.tar dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.tar.gz dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.tar.bz2 dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.tar.lz dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.tar.xz dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.tar.zst dexon-solidity-47e42430f27c579e09157f3373238e3bbe8ab93e.zip |
added type check if the type of the var decl is one of base contract type
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 11 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 12 |
2 files changed, 12 insertions, 11 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 8f38adac..aa423330 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5230,17 +5230,6 @@ BOOST_AUTO_TEST_CASE(storage_string_as_mapping_key_without_variable) BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2))); } -BOOST_AUTO_TEST_CASE(string_as_mapping_key) -{ - char const* sourceCode = R"( - contract Test { - function f() { var x = new Test(); } - } - )"; - - compileAndRun(sourceCode, 0, "Test"); -} - BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 9f352b36..2b343db3 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() } |