diff options
author | Christian <c@ethdev.com> | 2014-12-11 21:19:11 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-12-11 21:19:11 +0800 |
commit | 6dcb545cc8a88679d46ab9667beb52e7874df128 (patch) | |
tree | f16e65cd976de9eb2f8a9fe8f1644f698715b966 | |
parent | 1a76615a87d64cefe45066bf574dcce52e547f33 (diff) | |
download | dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.tar dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.tar.gz dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.tar.bz2 dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.tar.lz dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.tar.xz dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.tar.zst dexon-solidity-6dcb545cc8a88679d46ab9667beb52e7874df128.zip |
Support empty strings.
-rw-r--r-- | solidityEndToEndTest.cpp | 14 | ||||
-rw-r--r-- | solidityNameAndTypeResolution.cpp | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/solidityEndToEndTest.cpp b/solidityEndToEndTest.cpp index 940ccac6..5523ded3 100644 --- a/solidityEndToEndTest.cpp +++ b/solidityEndToEndTest.cpp @@ -510,6 +510,20 @@ BOOST_AUTO_TEST_CASE(strings) BOOST_CHECK(callContractFunction(1, bytes({0x00, 0x02, 0x01})) == expectation); } +BOOST_AUTO_TEST_CASE(empty_string_on_stack) +{ + char const* sourceCode = "contract test {\n" + " function run(string0 empty, uint8 inp) returns(uint16 a, string0 b, string4 c) {\n" + " var x = \"abc\";\n" + " var y = \"\";\n" + " var z = inp;\n" + " a = z; b = y; c = x;" + " }\n" + "}\n"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction(0, bytes({0x02})) == bytes({0x00, 0x02, 'a', 'b', 'c', 0x00})); +} + BOOST_AUTO_TEST_CASE(state_smoke_test) { char const* sourceCode = "contract test {\n" diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp index 7357471c..03eaebb3 100644 --- a/solidityNameAndTypeResolution.cpp +++ b/solidityNameAndTypeResolution.cpp @@ -226,14 +226,6 @@ BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } -BOOST_AUTO_TEST_CASE(empty_string_literal) -{ - char const* text = "contract test {\n" - " function f() { var x = \"\"; }" - "}\n"; - BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); -} - BOOST_AUTO_TEST_CASE(large_string_literal) { char const* text = "contract test {\n" |