js/src/tests/ecma_2/Statements/dowhile-005.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6
michael@0 7 /**
michael@0 8 * File Name: dowhile-005
michael@0 9 * ECMA Section:
michael@0 10 * Description: do...while statements
michael@0 11 *
michael@0 12 * Test a labeled do...while. Break out of the loop with no label
michael@0 13 * should break out of the loop, but not out of the label.
michael@0 14 *
michael@0 15 * Currently causes an infinite loop in the monkey. Uncomment the
michael@0 16 * print statement below and it works OK.
michael@0 17 *
michael@0 18 * Author: christine@netscape.com
michael@0 19 * Date: 26 August 1998
michael@0 20 */
michael@0 21 var SECTION = "dowhile-005";
michael@0 22 var VERSION = "ECMA_2";
michael@0 23 var TITLE = "do...while with a labeled continue statement";
michael@0 24 var BUGNUMBER = "316293";
michael@0 25
michael@0 26 startTest();
michael@0 27 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 28
michael@0 29 NestedLabel();
michael@0 30
michael@0 31
michael@0 32 test();
michael@0 33
michael@0 34 function NestedLabel() {
michael@0 35 i = 0;
michael@0 36 result1 = "pass";
michael@0 37 result2 = "fail: did not hit code after inner loop";
michael@0 38 result3 = "pass";
michael@0 39
michael@0 40 outer: {
michael@0 41 do {
michael@0 42 inner: {
michael@0 43 // print( i );
michael@0 44 break inner;
michael@0 45 result1 = "fail: did break out of inner label";
michael@0 46 }
michael@0 47 result2 = "pass";
michael@0 48 break outer;
michael@0 49 print(i);
michael@0 50 } while ( i++ < 100 );
michael@0 51
michael@0 52 }
michael@0 53
michael@0 54 result3 = "fail: did not break out of outer label";
michael@0 55
michael@0 56 new TestCase(
michael@0 57 SECTION,
michael@0 58 "number of loop iterations",
michael@0 59 0,
michael@0 60 i );
michael@0 61
michael@0 62 new TestCase(
michael@0 63 SECTION,
michael@0 64 "break out of inner loop",
michael@0 65 "pass",
michael@0 66 result1 );
michael@0 67
michael@0 68 new TestCase(
michael@0 69 SECTION,
michael@0 70 "break out of outer loop",
michael@0 71 "pass",
michael@0 72 result2 );
michael@0 73 }

mercurial