mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
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:
commit
a904cafa38
@ -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()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user