diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-23 21:56:40 +0800 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2018-04-23 23:10:10 +0800 |
commit | 6d26ad1e61cd6d711332cf3f9df87917157b6a3f (patch) | |
tree | 5001f37abfe103cd5803c81b808e1779145a2f81 | |
parent | fa2a28abc2484390a97c83af58646e4327673e96 (diff) | |
download | dexon-solidity-6d26ad1e61cd6d711332cf3f9df87917157b6a3f.tar.gz dexon-solidity-6d26ad1e61cd6d711332cf3f9df87917157b6a3f.tar.zst dexon-solidity-6d26ad1e61cd6d711332cf3f9df87917157b6a3f.zip |
Extract subdenomination tests
3 files changed, 11 insertions, 19 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 3081b8f2..a2540302 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2278,25 +2278,6 @@ BOOST_AUTO_TEST_CASE(explicit_conversion_from_decimal_to_bytesxx) CHECK_SUCCESS_NO_WARNINGS(text); } -BOOST_AUTO_TEST_CASE(combining_hex_and_denomination) -{ - char const* text = R"( - contract Foo { - uint constant x = 0x01 wei; - } - )"; - CHECK_WARNING(text, "Hexadecimal numbers with unit denominations are deprecated."); - - char const* textV050 = R"( - pragma experimental "v0.5.0"; - - contract Foo { - uint constant x = 0x01 wei; - } - )"; - CHECK_ERROR(textV050, TypeError, "Hexadecimal numbers cannot be used with unit denominations."); -} - BOOST_AUTO_TEST_CASE(assigning_value_to_const_variable) { char const* text = R"( diff --git a/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol new file mode 100644 index 00000000..3571e8a9 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination.sol @@ -0,0 +1,5 @@ +contract C { + uint constant x = 0x01 wei; +} +// ---- +// Warning: (32-40): Hexadecimal numbers with unit denominations are deprecated. You can use an expression of the form "0x1234 * 1 day" instead. diff --git a/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination_050.sol b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination_050.sol new file mode 100644 index 00000000..98865999 --- /dev/null +++ b/test/libsolidity/syntaxTests/denominations/combining_hex_and_denomination_050.sol @@ -0,0 +1,6 @@ +pragma experimental "v0.5.0"; +contract C { + uint constant x = 0x01 wei; +} +// ---- +// TypeError: (62-70): Hexadecimal numbers cannot be used with unit denominations. You can use an expression of the form "0x1234 * 1 day" instead. |