test: add a test case converting an invalid UTF-8 into a string

This commit is contained in:
Yoichi Hirai 2016-11-25 13:13:47 +01:00
parent ba94b0ae1b
commit aaf58a8c4e
No known key found for this signature in database
GPG Key ID: E7B75D080FCF7992

View File

@ -2038,6 +2038,16 @@ BOOST_AUTO_TEST_CASE(string)
BOOST_CHECK_NO_THROW(parseAndAnalyse(sourceCode)); 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) BOOST_AUTO_TEST_CASE(string_index)
{ {
char const* sourceCode = R"( char const* sourceCode = R"(