aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorGav Wood <g@ethdev.com>2015-01-29 08:20:33 +0800
committerGav Wood <g@ethdev.com>2015-01-29 08:20:33 +0800
commit1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8 (patch)
tree8a3e4b4e9388f3f136a32fff3fdbdfae86458db1 /SolidityEndToEndTest.cpp
parent9f3b2e00b41d26137461875b467089dadefaf1e7 (diff)
parentf377960012d93c91a3bf01a0264fdd2c83fcc7b7 (diff)
downloaddexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.tar
dexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.tar.gz
dexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.tar.bz2
dexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.tar.lz
dexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.tar.xz
dexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.tar.zst
dexon-solidity-1ea693f3ff2fc10a8f8a94a3e2e2bf862a6d27b8.zip
Merge pull request #877 from chriseth/sol_super
Super keyword.
Diffstat (limited to 'SolidityEndToEndTest.cpp')
-rw-r--r--SolidityEndToEndTest.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 1ddb2273..1450095a 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -1930,6 +1930,30 @@ BOOST_AUTO_TEST_CASE(crazy_elementary_typenames_on_stack)
BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(-7)));
}
+BOOST_AUTO_TEST_CASE(super)
+{
+ char const* sourceCode = R"(
+ contract A { function f() returns (uint r) { return 1; } }
+ contract B is A { function f() returns (uint r) { return super.f() | 2; } }
+ contract C is A { function f() returns (uint r) { return super.f() | 4; } }
+ contract D is B, C { function f() returns (uint r) { return super.f() | 8; } }
+ )";
+ compileAndRun(sourceCode, 0, "D");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 | 2 | 4 | 8));
+}
+
+BOOST_AUTO_TEST_CASE(super_in_constructor)
+{
+ char const* sourceCode = R"(
+ contract A { function f() returns (uint r) { return 1; } }
+ contract B is A { function f() returns (uint r) { return super.f() | 2; } }
+ contract C is A { function f() returns (uint r) { return super.f() | 4; } }
+ contract D is B, C { uint data; function D() { data = super.f() | 8; } function f() returns (uint r) { return data; } }
+ )";
+ compileAndRun(sourceCode, 0, "D");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 | 2 | 4 | 8));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}