test/script/basic/NASHORN-73.js

changeset 962
ac62e33a99b0
parent 7
5a1b0714df0e
child 1205
4112748288bb
equal deleted inserted replaced
961:93b032dd26bc 962:ac62e33a99b0
1 /* 1 /*
2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT 9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that 12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code). 13 * accompanied this code).
14 * 14 *
15 * You should have received a copy of the GNU General Public License version 15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation, 16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 * 18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any 20 * or visit www.oracle.com if you need additional information or have any
21 * questions. 21 * questions.
22 */ 22 */
23 23
48 print("THIS SHOULD NEVER BE PRINTED!"); 48 print("THIS SHOULD NEVER BE PRINTED!");
49 } 49 }
50 50
51 while (true) { 51 while (true) {
52 break; 52 break;
53 if (true) { 53 if (true) {
54 var s; 54 var s;
55 } 55 }
56 } 56 }
57 57
58 print("s = "+s); 58 print("s = "+s);
59 59
60 print("u = "+u); 60 print("u = "+u);
61 for ( ; ; ) { 61 for ( ; ; ) {
62 break; 62 break;
63 while (true) { 63 while (true) {
64 do { 64 do {
65 var u; 65 var u;
66 } while (true); 66 } while (true);
67 } 67 }
68 } 68 }
69 69
70 function terminal() { 70 function terminal() {
71 print("r = "+r); 71 print("r = "+r);
72 print("t = "+t); 72 print("t = "+t);
73 for (;;) { 73 for (;;) {
74 var r; 74 var r;
75 return; 75 return;
76 var t; 76 var t;
77 print("THIS SHOULD NEVER BE PRINTED!"); 77 print("THIS SHOULD NEVER BE PRINTED!");
78 } 78 }
79 print("NEITHER SHOULD THIS"); 79 print("NEITHER SHOULD THIS");
80 } 80 }
81 81
82 terminal(); 82 terminal();
83 83
84 function terminal2() { 84 function terminal2() {
85 print("q = "+q); 85 print("q = "+q);
86 for (;;) { 86 for (;;) {
87 return; 87 return;
88 print("THIS SHOULD NEVER BE PRINTED!"); 88 print("THIS SHOULD NEVER BE PRINTED!");
89 } 89 }
90 print("NEITHER SHOULD THIS"); 90 print("NEITHER SHOULD THIS");
91 } 91 }
92 92
93 try { 93 try {
94 terminal2(); 94 terminal2();
95 } catch (e) { 95 } catch (e) {
96 print(e); 96 print(e);
97 } 97 }
98 98
106 try { 106 try {
107 print("b is = "+b); 107 print("b is = "+b);
108 } catch (e) { 108 } catch (e) {
109 print(e); 109 print(e);
110 } 110 }
111 111
112 112
113 function disp_a() { 113 function disp_a() {
114 var a = 20; 114 var a = 20;
115 print("Value of 'a' inside the function " + a); 115 print("Value of 'a' inside the function " + a);
116 } 116 }
117 117
118 var a = 10; 118 var a = 10;
119 119
120 disp_a(); 120 disp_a();
121 121
122 print("Value of 'a' outside the function " + a); 122 print("Value of 'a' outside the function " + a);

mercurial