aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorLianaHus <liana@ethdev.com>2015-08-24 19:48:20 +0800
committerLianaHus <liana@ethdev.com>2015-08-24 19:48:20 +0800
commitffcf18406b605afe56f545fa4a41bc3bbb870c28 (patch)
tree41d1f2c08f77e5ed7b8b74bb4819f8dbe8560c62 /test/libsolidity
parent625be53252d6ef98a20b7e5abd3e675fcbc55c6b (diff)
downloaddexon-solidity-ffcf18406b605afe56f545fa4a41bc3bbb870c28.tar.gz
dexon-solidity-ffcf18406b605afe56f545fa4a41bc3bbb870c28.tar.zst
dexon-solidity-ffcf18406b605afe56f545fa4a41bc3bbb870c28.zip
added test to check string as mapping key
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index d74fd180..3f021708 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -5182,6 +5182,22 @@ BOOST_AUTO_TEST_CASE(accessor_for_const_state_variable)
compileAndRun(sourceCode);
BOOST_CHECK(callContractFunction("ticketPrice()") == encodeArgs(u256(555)));
}
+
+BOOST_AUTO_TEST_CASE(storage_string_as_mapping_key_without_variable)
+{
+ char const* sourceCode = R"(
+ contract Test {
+ mapping(string => uint) data;
+ function f() returns (uint) {
+ data["abc"] = 2;
+ return data["abc"];
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "Test");
+ BOOST_CHECK(callContractFunction("f()") == encodeArgs(u256(2)));
+}
+
BOOST_AUTO_TEST_SUITE_END()
}