diff options
author | chriseth <c@ethdev.com> | 2015-07-16 18:31:24 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-07-16 18:31:24 +0800 |
commit | c432ec46f922bd2223ab93df6001050a1631d50d (patch) | |
tree | bd30365c7d08e1937c6b83ae566943a9601cf6a1 | |
parent | 13effae9d3247ff29f91310b18367fdb5920736d (diff) | |
parent | bb181d8c856d86e042aad62cdf792149f352e948 (diff) | |
download | dexon-solidity-c432ec46f922bd2223ab93df6001050a1631d50d.tar.gz dexon-solidity-c432ec46f922bd2223ab93df6001050a1631d50d.tar.zst dexon-solidity-c432ec46f922bd2223ab93df6001050a1631d50d.zip |
Merge pull request #2482 from chriseth/sol_fix_initialiseStorageStrings
Fix for initialising storage strings.
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index b5c78656..f4b74a37 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -5033,6 +5033,21 @@ BOOST_AUTO_TEST_CASE(literal_strings) BOOST_CHECK(callContractFunction("empty()") == encodeDyn(string())); } +BOOST_AUTO_TEST_CASE(initialise_string_constant) +{ + char const* sourceCode = R"( + contract Test { + string public short = "abcdef"; + string public long = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678900123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; + } + )"; + compileAndRun(sourceCode, 0, "Test"); + string longStr = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678900123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789001234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890"; + string shortStr = "abcdef"; + + BOOST_CHECK(callContractFunction("long()") == encodeDyn(longStr)); + BOOST_CHECK(callContractFunction("short()") == encodeDyn(shortStr)); +} BOOST_AUTO_TEST_CASE(memory_structs_with_mappings) { |