Debian Codegraph @

rhino/testsrc/tests/ecma_2/Statements/label-002.js

raw symbols SCIP
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 gTestfile = 'label-002.js';
7
8 /**
9 * File Name: label-002.js
10 * ECMA Section:
11 * Description: Labeled statements
12 *
13 * Labeled break and continue within a for-in loop.
14 *
15 *
16 * Author: [email protected]
17 * Date: 11 August 1998
18 */
19 var SECTION = "label-002";
20 var VERSION = "ECMA_2";
21 var TITLE = "Labeled statements";
22
23 startTest();
24 writeHeaderToLog( SECTION + " "+ TITLE);
25
26 LabelTest( { p1:"hi,", p2:" norris" }, "hi, norris", " norrishi," );
27 LabelTest( { 0:"zero", 1:"one" }, "zeroone", "onezero" );
28
29 LabelTest2( { p1:"hi,", p2:" norris" }, "hi,", " norris" );
30 LabelTest2( { 0:"zero", 1:"one" }, "zero", "one" );
31
32 test();
33
34 function LabelTest( object, expect1, expect2 ) {
35 result = "";
36
37 yoohoo: { for ( property in object ) { result += object[property]; }; break yoohoo };
38
39 new TestCase(
40 SECTION,
41 "yoohoo: for ( property in object ) { result += object[property]; } break yoohoo }",
42 true,
43 result == expect1 || result == expect2 );
44 }
45
46 function LabelTest2( object, expect1, expect2 ) {
47 result = "";
48
49 yoohoo: { for ( property in object ) { result += object[property]; break yoohoo } }; ;
50
51 new TestCase(
52 SECTION,
53 "yoohoo: for ( property in object ) { result += object[property]; break yoohoo }}",
54 true,
55 result == expect1 || result == expect2 );
56 }
57