mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Ignore break and continue outside of loops.
This commit is contained in:
parent
b20e70b4b4
commit
008a91ca9d
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user