diff options
author | chriseth <chris@ethereum.org> | 2017-11-22 23:24:59 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-11-22 23:27:32 +0800 |
commit | 9232cd2621113dac43829b7f0dd37f791526f0b4 (patch) | |
tree | 15f0493adc82ae4ad15c29a8fd5646345a0e7f7c /test/libjulia/Parser.cpp | |
parent | e15918d8b6fd106d147d00d0c3405df88ab39b64 (diff) | |
download | dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.tar dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.tar.gz dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.tar.bz2 dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.tar.lz dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.tar.xz dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.tar.zst dexon-solidity-9232cd2621113dac43829b7f0dd37f791526f0b4.zip |
Tests.
Diffstat (limited to 'test/libjulia/Parser.cpp')
-rw-r--r-- | test/libjulia/Parser.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp index f8c1aa4d..473a1d2c 100644 --- a/test/libjulia/Parser.cpp +++ b/test/libjulia/Parser.cpp @@ -269,6 +269,19 @@ BOOST_AUTO_TEST_CASE(multiple_assignment) BOOST_CHECK(successParse(text)); } +BOOST_AUTO_TEST_CASE(if_statement) +{ + BOOST_CHECK(successParse("{ if 42:u256 {} }")); + BOOST_CHECK(successParse("{ if 42:u256 { let x:u256 := 3:u256 } }")); + BOOST_CHECK(successParse("{ function f() -> x:u256 {} if f() { let b:u256 := f() } }")); +} + +BOOST_AUTO_TEST_CASE(if_statement_invalid) +{ + CHECK_ERROR("{ if let x:u256 {} }", ParserError, "Literal or identifier expected."); + CHECK_ERROR("{ if 32:u256 let x:u256 := 3:u256 }", ParserError, "Expected token LBrace"); +} + BOOST_AUTO_TEST_SUITE_END() } |