diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-09-18 18:39:17 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-10-18 00:59:01 +0800 |
commit | c99d2aae042643d9d26a4b952e07ca90f11a83c3 (patch) | |
tree | 4935870d142b7870900a480bcbe66ef2cc146f4d /test | |
parent | c67b559ead9676fb1983e09c512dd9f483c0b6f1 (diff) | |
download | dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.gz dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.bz2 dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.lz dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.xz dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.tar.zst dexon-solidity-c99d2aae042643d9d26a4b952e07ca90f11a83c3.zip |
Validate each tuple literal
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 2c720d03..e9066c32 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -5537,7 +5537,7 @@ BOOST_AUTO_TEST_CASE(invalid_mobile_type) } } )"; - CHECK_ERROR(text, TypeError, "Invalid mobile type."); + CHECK_ERROR(text, TypeError, "Invalid rational number."); } BOOST_AUTO_TEST_CASE(warns_msg_value_in_non_payable_public_function) @@ -7096,6 +7096,37 @@ BOOST_AUTO_TEST_CASE(non_external_fallback) CHECK_ERROR(text, TypeError, "Fallback function must be defined as \"external\"."); } +BOOST_AUTO_TEST_CASE(invalid_literal_in_tuple) +{ + char const* text = R"( + contract C { + function f() pure public { + uint x; + (x, ) = (1E111); + } + } + )"; + CHECK_ERROR(text, TypeError, "Invalid rational number."); + text = R"( + contract C { + function f() pure public { + uint x; + (x, ) = (1, 1E111); + } + } + )"; + CHECK_ERROR(text, TypeError, "Invalid rational number."); + text = R"( + contract C { + function f() pure public { + uint x; + (x, ) = (1E111, 1); + } + } + )"; + CHECK_ERROR(text, TypeError, "Invalid rational number."); +} + BOOST_AUTO_TEST_CASE(warn_about_sha3) { char const* text = R"( |