diff options
author | Liana Husikyan <liana@ethdev.com> | 2015-05-08 00:12:58 +0800 |
---|---|---|
committer | Liana Husikyan <liana@ethdev.com> | 2015-05-08 23:51:53 +0800 |
commit | 960033de6bea1e436656ccc71b5152efd4314036 (patch) | |
tree | 166b2562dd326c65ca99cd655e92f1b64f7a0b2e /libsolidity | |
parent | 757972b4e35ab30774355a4868b6bc5a49dda3d9 (diff) | |
download | dexon-solidity-960033de6bea1e436656ccc71b5152efd4314036.tar.gz dexon-solidity-960033de6bea1e436656ccc71b5152efd4314036.tar.zst dexon-solidity-960033de6bea1e436656ccc71b5152efd4314036.zip |
fixed the test
Diffstat (limited to 'libsolidity')
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 29 | ||||
-rw-r--r-- | libsolidity/SolidityNameAndTypeResolution.cpp | 19 |
2 files changed, 29 insertions, 19 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index f168ad45..2fd1e2ec 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -3910,6 +3910,35 @@ BOOST_AUTO_TEST_CASE(external_types_in_calls) BOOST_CHECK(callContractFunction("nonexisting") == encodeArgs(u256(9))); } +BOOST_AUTO_TEST_CASE(proper_order_of_overwriting_of_attributes) +{ + // bug #1798 + char const* sourceCode = R"( + contract init { + function isOk() returns (bool) { return false; } + bool public ok = false; + } + contract fix { + function isOk() returns (bool) { return true; } + bool public ok = true; + } + + contract init_fix is init, fix { + function checkOk() returns (bool) { return ok; } + } + contract fix_init is fix, init { + function checkOk() returns (bool) { return ok; } + } + )"; + compileAndRun(sourceCode, 0, "init_fix"); + BOOST_CHECK(callContractFunction("isOk()") == encodeArgs(true)); + BOOST_CHECK(callContractFunction("ok()") == encodeArgs(true)); + + compileAndRun(sourceCode, 0, "fix_init"); + BOOST_CHECK(callContractFunction("isOk()") == encodeArgs(false)); + BOOST_CHECK(callContractFunction("ok()") == encodeArgs(false)); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp index 9616777a..c317dad9 100644 --- a/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1761,25 +1761,6 @@ BOOST_AUTO_TEST_CASE(uninitialized_var) BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); } -BOOST_AUTO_TEST_CASE(deny_overwriting_of_attributes_when_deriving) -{ - // bug #1798 - char const* sourceCode = R"( - contract owned { - address owner; - } - - contract reg { - function owner(bytes32 x) returns (address) {} - } - - contract x is owned, reg { - } - )"; - ETH_TEST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode), "Parsing and Name Resolving Failed"); - //BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); -} - BOOST_AUTO_TEST_SUITE_END() } |