Merge pull request #2473 from chriseth/sol_fix_exponentialNotation

Check whether a literal is a valid literal before using it.
This commit is contained in:
Gav Wood 2015-07-14 18:18:38 +02:00
commit a904cafa38

View File

@ -2110,6 +2110,30 @@ BOOST_AUTO_TEST_CASE(literal_strings)
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
BOOST_AUTO_TEST_CASE(invalid_integer_literal_fraction)
{
char const* text = R"(
contract Foo {
function f() {
var x = 1.20;
}
}
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
}
BOOST_AUTO_TEST_CASE(invalid_integer_literal_exp)
{
char const* text = R"(
contract Foo {
function f() {
var x = 1e2;
}
}
)";
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
}
BOOST_AUTO_TEST_SUITE_END()
}