diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-12-23 01:14:09 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2016-01-23 01:14:00 +0800 |
commit | 4471a2ce3bda9ff802bb9701d042b5c68c312495 (patch) | |
tree | fda6893047a4aea1ea2fdd9bfefe32c01d774e11 /test | |
parent | 0a45fe04f309e5524f06132e7fd0fe48b0183cbc (diff) | |
download | dexon-solidity-4471a2ce3bda9ff802bb9701d042b5c68c312495.tar.gz dexon-solidity-4471a2ce3bda9ff802bb9701d042b5c68c312495.tar.zst dexon-solidity-4471a2ce3bda9ff802bb9701d042b5c68c312495.zip |
[cond-expr] add test cases for type resolution
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index c8e901e4..73f6a6c8 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2960,6 +2960,30 @@ BOOST_AUTO_TEST_CASE(continue_not_in_loop_2) BOOST_CHECK(expectError(text) == Error::Type::SyntaxError); } +BOOST_AUTO_TEST_CASE(invalid_different_types_for_conditional_expression) +{ + char const* text = R"( + contract C { + function f() { + true ? true : 2; + } + } + )"; + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + +BOOST_AUTO_TEST_CASE(invalid_left_value_in_conditional_expression) +{ + char const* text = R"( + contract C { + function f() { + (true ? 3 : 5) = 1; + } + } + )"; + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_SUITE_END() } |