]>
git.saurik.com Git - apple/javascriptcore.git/blob - tests/mozilla/ecma_2/Statements/dowhile-006.js
2 * File Name: dowhile-006
4 * Description: do...while statements
6 * A general do...while test.
8 * Author: christine@netscape.com
11 var SECTION
= "dowhile-006";
12 var VERSION
= "ECMA_2";
13 var TITLE
= "do...while";
16 writeHeaderToLog( SECTION
+ " "+ TITLE
);
19 var testcases
= new Array();
21 DoWhile( new DoWhileObject( false, false, 10 ) );
22 DoWhile( new DoWhileObject( true, false, 2 ) );
23 DoWhile( new DoWhileObject( false, true, 3 ) );
24 DoWhile( new DoWhileObject( true, true, 4 ) );
28 function looping( object
) {
31 if ( object
.iterations
<= 0 ) {
37 function DoWhileObject( breakOut
, breakIn
, iterations
, loops
) {
38 this.iterations
= iterations
;
40 this.breakOut
= breakOut
;
41 this.breakIn
= breakIn
;
42 this.looping
= looping
;
44 function DoWhile( object
) {
51 if ( object
.breakOut
)
57 } while ( looping(object
) );
59 // statements should be executed if:
60 // do...while exits normally
61 // do...while exits abruptly with no label
67 // statements should be executed if:
68 // do...while breaks out with label "innie"
69 // do...while exits normally
70 // do...while does not break out with "outie"
75 testcases
[tc
++] = new TestCase(
77 "hit code after loop in inner loop",
78 ( object
.breakIn
|| object
.breakOut
) ? false : true ,
81 testcases
[tc
++] = new TestCase(
83 "hit code after loop in outer loop",
84 ( object
.breakOut
) ? false : true,