diff options
author | LianaHus <liana@ethdev.com> | 2015-09-15 22:33:14 +0800 |
---|---|---|
committer | LianaHus <liana@ethdev.com> | 2015-09-16 19:25:32 +0800 |
commit | 279a36b6f8249df48b92574437f57742897841a5 (patch) | |
tree | b40646e4a672ed61610c15a8e3bd28040436acae /test/libsolidity | |
parent | 9d43f2c186d1ad4027d42f6b155bea5500efa0e5 (diff) | |
download | dexon-solidity-279a36b6f8249df48b92574437f57742897841a5.tar.gz dexon-solidity-279a36b6f8249df48b92574437f57742897841a5.tar.zst dexon-solidity-279a36b6f8249df48b92574437f57742897841a5.zip |
throw statement implementation
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 2ba6ab85..9c4d0c5b 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -5265,6 +5265,24 @@ BOOST_AUTO_TEST_CASE(library_stray_values) BOOST_CHECK(callContractFunction("f(uint256)", u256(33)) == encodeArgs(u256(42))); } +BOOST_AUTO_TEST_CASE(simple_throw) +{ + char const* sourceCode = R"( + contract Test { + function f(uint x) returns (uint) { + if (x > 10) + return x + 10; + else + throw; + return 2; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("f(uint256)", u256(11)) == encodeArgs(u256(21))); + BOOST_CHECK(callContractFunction("f(uint256)", u256(1)) == encodeArgs()); +} + BOOST_AUTO_TEST_SUITE_END() } |