]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Statements/dowhile-002.js
2 * File Name: dowhile-002
4 * Description: do...while statements
6 * Verify that code after a labeled break is not executed. Verify that
7 * a labeled break breaks you out of the whole labeled block, and not
8 * just the current iteration statement.
10 * Author: christine@netscape.com
11 * Date: 11 August 1998
13 var SECTION
= "dowhile-002";
14 var VERSION
= "ECMA_2";
15 var TITLE
= "do...while with a labeled continue statement";
18 writeHeaderToLog( SECTION
+ " "+ TITLE
);
21 var testcases
= new Array();
23 LabeledContinue( 0, 1 );
24 LabeledContinue( 1, 1 );
25 LabeledContinue( -1, 1 );
26 LabeledContinue( 5, 5 );
30 // The labeled statment contains statements after the labeled break.
31 // Verify that the statements after the break are not executed.
33 function LabeledContinue( limit
, expect
) {
41 if ( ! (i
< limit
) ) {
43 result1
= "fail: evaluated statement after a labeled break";
47 result2
= "failed: broke out of loop, but not out of labeled block";
50 testcases
[tc
++] = new TestCase(
52 "do while ( " + i
+" < " + limit
+" )",
56 testcases
[tc
++] = new TestCase(
58 "breaking out of a do... while loop",
63 testcases
[tc
++] = new TestCase(
65 "breaking out of a labeled do...while loop",