js/src/tests/ecma_2/Statements/label-002.js

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:63a33f617f3d
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
7 /**
8 * File Name: label-002.js
9 * ECMA Section:
10 * Description: Labeled statements
11 *
12 * Labeled break and continue within a for-in loop.
13 *
14 *
15 * Author: christine@netscape.com
16 * Date: 11 August 1998
17 */
18 var SECTION = "label-002";
19 var VERSION = "ECMA_2";
20 var TITLE = "Labeled statements";
21
22 startTest();
23 writeHeaderToLog( SECTION + " "+ TITLE);
24
25 LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
26 LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
27
28 LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
29 LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
30
31 test();
32
33 function LabelTest( object, expect1, expect2 ) {
34 result = "";
35
36 yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
37
38 new TestCase(
39 SECTION,
40 "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
41 true,
42 result == expect1 || result == expect2 );
43 }
44
45 function LabelTest2( object, expect1, expect2 ) {
46 result = "";
47
48 yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
49
50 new TestCase(
51 SECTION,
52 "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
53 true,
54 result == expect1 || result == expect2 );
55 }
56

mercurial