aboutsummaryrefslogtreecommitdiffstats
path: root/solidityNameAndTypeResolution.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-11 00:15:10 +0800
committerChristian <c@ethdev.com>2014-12-11 00:15:10 +0800
commit1a76615a87d64cefe45066bf574dcce52e547f33 (patch)
tree37c187b127de50e6e04ca5f451d0af0bcea7757e /solidityNameAndTypeResolution.cpp
parentbf8ea705b8f7b33b1bd2cd90f6637b0b3014f8db (diff)
downloaddexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.tar
dexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.tar.gz
dexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.tar.bz2
dexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.tar.lz
dexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.tar.xz
dexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.tar.zst
dexon-solidity-1a76615a87d64cefe45066bf574dcce52e547f33.zip
Tests for empty and too long strings.
Diffstat (limited to 'solidityNameAndTypeResolution.cpp')
-rw-r--r--solidityNameAndTypeResolution.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp
index 78397229..7357471c 100644
--- a/solidityNameAndTypeResolution.cpp
+++ b/solidityNameAndTypeResolution.cpp
@@ -226,6 +226,22 @@ 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"
+ " function f() { var x = \"123456789012345678901234567890123\"; }"
+ "}\n";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+}
+
BOOST_AUTO_TEST_CASE(balance)
{
char const* text = "contract test {\n"