diff options
author | Christian <c@ethdev.com> | 2014-11-06 01:44:05 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-06 09:46:48 +0800 |
commit | 008a91ca9ded6950fce4f094e6cb46f50a6be4b7 (patch) | |
tree | 261d022855bc7024488782571d0c83c82523f21f | |
parent | b20e70b4b4357cadcaf4392a2cff7c0e6c6fe126 (diff) | |
download | dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.tar dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.tar.gz dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.tar.bz2 dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.tar.lz dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.tar.xz dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.tar.zst dexon-solidity-008a91ca9ded6950fce4f094e6cb46f50a6be4b7.zip |
Ignore break and continue outside of loops.
-rw-r--r-- | solidityEndToEndTest.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/solidityEndToEndTest.cpp b/solidityEndToEndTest.cpp index 7b9e0738..116310ae 100644 --- a/solidityEndToEndTest.cpp +++ b/solidityEndToEndTest.cpp @@ -151,6 +151,19 @@ BOOST_AUTO_TEST_CASE(while_loop) BOOST_CHECK(framework.callFunction(0, u256(4)) == toBigEndian(u256(24))); } +BOOST_AUTO_TEST_CASE(break_outside_loop) +{ + // break and continue outside loops should be simply ignored + char const* sourceCode = "contract test {\n" + " function f(uint x) returns(uint y) {\n" + " break; continue; return 2;\n" + " }\n" + "}\n"; + ExecutionFramework framework; + framework.compileAndRun(sourceCode); + BOOST_CHECK(framework.callFunction(0, u256(0)) == toBigEndian(u256(2))); +} + BOOST_AUTO_TEST_CASE(nested_loops) { // tests that break and continue statements in nested loops jump to the correct place |