]> git.saurik.com Git - apple/javascriptcore.git/blame - tests/mozilla/ecma_2/Statements/label-002.js
JavaScriptCore-461.tar.gz
[apple/javascriptcore.git] / tests / mozilla / ecma_2 / Statements / label-002.js
CommitLineData
b37bf2e1
A
1/**
2 * File Name: label-002.js
3 * ECMA Section:
4 * Description: Labeled statements
5 *
6 * Labeled break and continue within a for-in loop.
7 *
8 *
9 * Author: christine@netscape.com
10 * Date: 11 August 1998
11 */
12 var SECTION = "label-002";
13 var VERSION = "ECMA_2";
14 var TITLE = "Labeled statements";
15
16 startTest();
17 writeHeaderToLog( SECTION + " "+ TITLE);
18
19 var tc = 0;
20 var testcases = new Array();
21
22 LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
23 LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
24
25 LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
26 LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
27
28 test();
29
30 function LabelTest( object, expect1, expect2 ) {
31 result = "";
32
33 yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
34
35 testcases[tc++] = new TestCase(
36 SECTION,
37 "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
38 true,
39 result == expect1 || result == expect2 );
40 }
41
42 function LabelTest2( object, expect1, expect2 ) {
43 result = "";
44
45 yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
46
47 testcases[tc++] = new TestCase(
48 SECTION,
49 "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
50 true,
51 result == expect1 || result == expect2 );
52 }
53