js/src/tests/js1_2/statements/continue.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 Filename: continue.js
michael@0 9 Description: 'Tests the continue statement'
michael@0 10
michael@0 11 Author: Nick Lerissa
michael@0 12 Date: March 18, 1998
michael@0 13 */
michael@0 14
michael@0 15 var SECTION = 'As described in Netscape doc "Whats new in JavaScript 1.2"';
michael@0 16 var VERSION = 'no version';
michael@0 17 startTest();
michael@0 18 var TITLE = 'statements: continue';
michael@0 19
michael@0 20 writeHeaderToLog("Executing script: continue.js");
michael@0 21 writeHeaderToLog( SECTION + " "+ TITLE);
michael@0 22
michael@0 23 var i,j;
michael@0 24
michael@0 25 j = 0;
michael@0 26 for (i = 0; i < 200; i++)
michael@0 27 {
michael@0 28 if (i == 100)
michael@0 29 continue;
michael@0 30 j++;
michael@0 31 }
michael@0 32
michael@0 33 // '"continue" in a "for" loop'
michael@0 34 new TestCase ( SECTION, '"continue" in "for" loop',
michael@0 35 199, j);
michael@0 36
michael@0 37
michael@0 38 j = 0;
michael@0 39 out1:
michael@0 40 for (i = 0; i < 1000; i++)
michael@0 41 {
michael@0 42 if (i == 100)
michael@0 43 {
michael@0 44 out2:
michael@0 45 for (var k = 0; k < 1000; k++)
michael@0 46 {
michael@0 47 if (k == 500) continue out1;
michael@0 48 }
michael@0 49 j = 3000;
michael@0 50 }
michael@0 51 j++;
michael@0 52 }
michael@0 53
michael@0 54 // '"continue" in a "for" loop with a "label"'
michael@0 55 new TestCase ( SECTION, '"continue" in "for" loop with a "label"',
michael@0 56 999, j);
michael@0 57
michael@0 58 i = 0;
michael@0 59 j = 1;
michael@0 60
michael@0 61 while (i != j)
michael@0 62 {
michael@0 63 i++;
michael@0 64 if (i == 100) continue;
michael@0 65 j++;
michael@0 66 }
michael@0 67
michael@0 68 // '"continue" in a "while" loop'
michael@0 69 new TestCase ( SECTION, '"continue" in a "while" loop',
michael@0 70 100, j );
michael@0 71
michael@0 72 j = 0;
michael@0 73 i = 0;
michael@0 74 out3:
michael@0 75 while (i < 1000)
michael@0 76 {
michael@0 77 if (i == 100)
michael@0 78 {
michael@0 79 var k = 0;
michael@0 80 out4:
michael@0 81 while (k < 1000)
michael@0 82 {
michael@0 83 if (k == 500)
michael@0 84 {
michael@0 85 i++;
michael@0 86 continue out3;
michael@0 87 }
michael@0 88 k++;
michael@0 89 }
michael@0 90 j = 3000;
michael@0 91 }
michael@0 92 j++;
michael@0 93 i++;
michael@0 94 }
michael@0 95
michael@0 96 // '"continue" in a "while" loop with a "label"'
michael@0 97 new TestCase ( SECTION, '"continue" in a "while" loop with a "label"',
michael@0 98 999, j);
michael@0 99
michael@0 100 i = 0;
michael@0 101 j = 1;
michael@0 102
michael@0 103 do
michael@0 104 {
michael@0 105 i++;
michael@0 106 if (i == 100) continue;
michael@0 107 j++;
michael@0 108 } while (i != j);
michael@0 109
michael@0 110
michael@0 111 // '"continue" in a "do" loop'
michael@0 112 new TestCase ( SECTION, '"continue" in a "do" loop',
michael@0 113 100, j );
michael@0 114
michael@0 115 j = 0;
michael@0 116 i = 0;
michael@0 117 out5:
michael@0 118 do
michael@0 119 {
michael@0 120 if (i == 100)
michael@0 121 {
michael@0 122 var k = 0;
michael@0 123 out6:
michael@0 124 do
michael@0 125 {
michael@0 126 if (k == 500)
michael@0 127 {
michael@0 128 i++;
michael@0 129 continue out5;
michael@0 130 }
michael@0 131 k++;
michael@0 132 }while (k < 1000);
michael@0 133 j = 3000;
michael@0 134 }
michael@0 135 j++;
michael@0 136 i++;
michael@0 137 }while (i < 1000);
michael@0 138
michael@0 139 // '"continue" in a "do" loop with a "label"'
michael@0 140 new TestCase ( SECTION, '"continue" in a "do" loop with a "label"',
michael@0 141 999, j);
michael@0 142
michael@0 143 test();

mercurial