aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2016-11-25 20:13:47 +0800
committerYoichi Hirai <i@yoichihirai.com>2016-11-25 20:13:47 +0800
commitaaf58a8c4e802b1c3c4098066e0788e55600660a (patch)
tree6db342b50a999dafd3e105f0f49acd0fae43da55
parentba94b0ae1b6529b9f15ea1023421aa8094f74d49 (diff)
downloaddexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.tar
dexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.tar.gz
dexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.tar.bz2
dexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.tar.lz
dexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.tar.xz
dexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.tar.zst
dexon-solidity-aaf58a8c4e802b1c3c4098066e0788e55600660a.zip
test: add a test case converting an invalid UTF-8 into a string
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index 6dc7ac8c..6181a8a9 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -2038,6 +2038,16 @@ BOOST_AUTO_TEST_CASE(string)
BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode));
}
+BOOST_AUTO_TEST_CASE(invalid_utf8)
+{
+ char const* sourceCode = R"(
+ contract C {
+ string s = "\xa0\x00";
+ }
+ )";
+ CHECK_ERROR(sourceCode, TypeError, "Invalid UTF-8");
+}
+
BOOST_AUTO_TEST_CASE(string_index)
{
char const* sourceCode = R"(