aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-10-21 18:22:08 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-10-24 22:28:14 +0800
commit47b11ef2b800f7eacbdf7329184b549ee33569ab (patch)
treed6a173ee7a34c3641e7d08dc84ecb6e037653a77
parent22f2c6df6316b1281753e1c626ad5523e8917246 (diff)
downloaddexon-solidity-47b11ef2b800f7eacbdf7329184b549ee33569ab.tar.gz
dexon-solidity-47b11ef2b800f7eacbdf7329184b549ee33569ab.tar.zst
dexon-solidity-47b11ef2b800f7eacbdf7329184b549ee33569ab.zip
test: add a test case for accessing a state variable under the contract's name
The test comes from the description of #988
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index bb197cca..2abd9aa1 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5666,6 +5666,21 @@ BOOST_AUTO_TEST_CASE(accessor_for_const_state_variable)
BOOST_CHECK(callContractFunction("ticketPrice()") == encodeArgs(u256(555)));
}
+BOOST_AUTO_TEST_CASE(state_variable_under_contract_name)
+{
+ char const* text = R"(
+ contract Scope {
+ uint stateVar = 42;
+
+ function getStateVar() constant returns (uint stateVar) {
+ stateVar = Scope.stateVar;
+ }
+ }
+ )";
+ compileAndRun(text);
+ BOOST_CHECK(callContractFunction("getStateVar()") == encodeArgs(u256(42)));
+}
+
BOOST_AUTO_TEST_CASE(constant_string_literal)
{
char const* sourceCode = R"(