diff options
author | chriseth <chris@ethereum.org> | 2019-01-22 20:49:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-22 20:49:41 +0800 |
commit | 10d17f245839f208ec5085309022a32cd2502f55 (patch) | |
tree | b2c9f68980d0d418cd6f511e9f3f3f71369abe25 /test/libyul/Parser.cpp | |
parent | 1df8f40cd2fd7b47698d847907b8ca7b47eb488d (diff) | |
parent | 0ecafe032a84cb6960545dd7f18733430c1f782d (diff) | |
download | dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.gz dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.bz2 dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.lz dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.xz dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.tar.zst dexon-solidity-10d17f245839f208ec5085309022a32cd2502f55.zip |
Merge pull request #5836 from ethereum/develop
Merge develop into release for 0.5.3.
Diffstat (limited to 'test/libyul/Parser.cpp')
-rw-r--r-- | test/libyul/Parser.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/libyul/Parser.cpp b/test/libyul/Parser.cpp index df7e32a1..84f5c14b 100644 --- a/test/libyul/Parser.cpp +++ b/test/libyul/Parser.cpp @@ -304,6 +304,19 @@ BOOST_AUTO_TEST_CASE(if_statement_invalid) BOOST_CHECK(successParse("{ if 42:u256 { } }")); } +BOOST_AUTO_TEST_CASE(switch_case_types) +{ + CHECK_ERROR("{ switch 0:u256 case 0:u256 {} case 1:u32 {} }", TypeError, "Switch cases have non-matching types."); + // The following should be an error in the future, but this is not yet detected. + BOOST_CHECK(successParse("{ switch 0:u256 case 0:u32 {} case 1:u32 {} }")); +} + +BOOST_AUTO_TEST_CASE(switch_duplicate_case) +{ + CHECK_ERROR("{ switch 0:u256 case 0:u256 {} case 0x0:u256 {} }", DeclarationError, "Duplicate case defined."); + BOOST_CHECK(successParse("{ switch 0:u256 case 42:u256 {} case 0x42:u256 {} }")); +} + BOOST_AUTO_TEST_CASE(builtins_parser) { struct SimpleDialect: public Dialect @@ -331,7 +344,7 @@ BOOST_AUTO_TEST_CASE(builtins_analysis) { return _name == "builtin"_yulstring ? &f : nullptr; } - BuiltinFunction f{"builtin"_yulstring, vector<Type>(2), vector<Type>(3), false}; + BuiltinFunction f{"builtin"_yulstring, vector<Type>(2), vector<Type>(3), false, false}; }; shared_ptr<Dialect> dialect = make_shared<SimpleDialect>(); |