1.1 --- a/test/script/basic/NASHORN-19.js Tue Aug 19 20:43:03 2014 +0100 1.2 +++ b/test/script/basic/NASHORN-19.js Wed Aug 20 10:25:28 2014 +0200 1.3 @@ -1,21 +1,21 @@ 1.4 /* 1.5 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 1.6 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 - * 1.8 + * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 * under the terms of the GNU General Public License version 2 only, as 1.11 * published by the Free Software Foundation. 1.12 - * 1.13 + * 1.14 * This code is distributed in the hope that it will be useful, but WITHOUT 1.15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.17 * version 2 for more details (a copy is included in the LICENSE file that 1.18 * accompanied this code). 1.19 - * 1.20 + * 1.21 * You should have received a copy of the GNU General Public License version 1.22 * 2 along with this work; if not, write to the Free Software Foundation, 1.23 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.24 - * 1.25 + * 1.26 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.27 * or visit www.oracle.com if you need additional information or have any 1.28 * questions. 1.29 @@ -38,8 +38,8 @@ 1.30 1.31 do { 1.32 with(myscope) { 1.33 - myvalue = 12; 1.34 - break; 1.35 + myvalue = 12; 1.36 + break; 1.37 } 1.38 } while (false); 1.39 1.40 @@ -62,15 +62,15 @@ 1.41 var scope2 = {value:20}; 1.42 while (true) { 1.43 with (scope) { 1.44 - print(value); 1.45 - value = 11; 1.46 - print(value); 1.47 - with (scope2) { 1.48 - print(value); 1.49 - value = 21; 1.50 - print(value); 1.51 - break; 1.52 - } 1.53 + print(value); 1.54 + value = 11; 1.55 + print(value); 1.56 + with (scope2) { 1.57 + print(value); 1.58 + value = 21; 1.59 + print(value); 1.60 + break; 1.61 + } 1.62 } 1.63 } 1.64 1.65 @@ -83,19 +83,19 @@ 1.66 var scope = {value:10}; 1.67 var scope2 = {value:20}; 1.68 while (true) { 1.69 - with (scope) { 1.70 - print(value); 1.71 - value = 11; 1.72 - print(value); 1.73 - with (scope2) { 1.74 - print(value); 1.75 - value = 21; 1.76 - print(value); 1.77 - break; 1.78 - } 1.79 - } 1.80 + with (scope) { 1.81 + print(value); 1.82 + value = 11; 1.83 + print(value); 1.84 + with (scope2) { 1.85 + print(value); 1.86 + value = 21; 1.87 + print(value); 1.88 + break; 1.89 + } 1.90 } 1.91 - 1.92 + } 1.93 + 1.94 print(value); 1.95 } 1.96 1.97 @@ -104,14 +104,14 @@ 1.98 var value = "hello"; 1.99 var scope = {value:10}; 1.100 while (true) { 1.101 - with (scope) { 1.102 - print(value); 1.103 - value = 11; 1.104 - print(value); 1.105 - if (value > ten()) { 1.106 - break; 1.107 - } 1.108 - } 1.109 + with (scope) { 1.110 + print(value); 1.111 + value = 11; 1.112 + print(value); 1.113 + if (value > ten()) { 1.114 + break; 1.115 + } 1.116 + } 1.117 } 1.118 print(value); 1.119 } 1.120 @@ -123,24 +123,24 @@ 1.121 var scope2 = {value:20}; 1.122 var outer = 0; 1.123 while (outer < 5) { 1.124 - var i=0; 1.125 - while (i < 10) { 1.126 - with(scope) { 1.127 - print("loop header "+i); 1.128 - with (scope2) { 1.129 - value = 11; 1.130 - i++; 1.131 - if ((i & 1) != 0) { 1.132 - print("continue"); 1.133 - continue; 1.134 - } 1.135 - } 1.136 - } 1.137 - print(value); 1.138 - } 1.139 - outer++; 1.140 + var i=0; 1.141 + while (i < 10) { 1.142 + with(scope) { 1.143 + print("loop header "+i); 1.144 + with (scope2) { 1.145 + value = 11; 1.146 + i++; 1.147 + if ((i & 1) != 0) { 1.148 + print("continue"); 1.149 + continue; 1.150 + } 1.151 + } 1.152 + } 1.153 + print(value); 1.154 } 1.155 -} 1.156 + outer++; 1.157 + } 1.158 +} 1.159 1.160 //continue one level 1.161 function test4() { 1.162 @@ -148,15 +148,15 @@ 1.163 var scope = {value:10}; 1.164 var i=0; 1.165 while (i < 10) { 1.166 - print("loop header "+i); 1.167 - with (scope) { 1.168 - value = 11; 1.169 - i++; 1.170 - if ((i & 1) != 0) { 1.171 - print("continue"); 1.172 - continue; 1.173 - } 1.174 - } 1.175 + print("loop header "+i); 1.176 + with (scope) { 1.177 + value = 11; 1.178 + i++; 1.179 + if ((i & 1) != 0) { 1.180 + print("continue"); 1.181 + continue; 1.182 + } 1.183 + } 1.184 } 1.185 print(value); 1.186 } 1.187 @@ -170,24 +170,24 @@ 1.188 var outer = 0; 1.189 outer_label: 1.190 while (outer < 5) { 1.191 - var i=0; 1.192 - while (i < 10) { 1.193 - with(scope) { 1.194 - print("loop header "+i); 1.195 - with (scope2) { 1.196 - value = 11; 1.197 - i++; 1.198 - if ((i & 1) != 0) { 1.199 - print("continue"); 1.200 - outer++; 1.201 - continue outer_label; 1.202 - } 1.203 - } 1.204 - } 1.205 - print(value); 1.206 - } 1.207 + var i=0; 1.208 + while (i < 10) { 1.209 + with(scope) { 1.210 + print("loop header "+i); 1.211 + with (scope2) { 1.212 + value = 11; 1.213 + i++; 1.214 + if ((i & 1) != 0) { 1.215 + print("continue"); 1.216 + outer++; 1.217 + continue outer_label; 1.218 + } 1.219 + } 1.220 + } 1.221 + print(value); 1.222 } 1.223 -} 1.224 + } 1.225 +} 1.226 1.227 //labelled break 1.228 function test6() { 1.229 @@ -196,21 +196,21 @@ 1.230 var scope2 = {value:20}; 1.231 outer: 1.232 { 1.233 - var i=0; 1.234 - while (i < 10) { 1.235 - with(scope) { 1.236 - print("loop header "+i); 1.237 - with (scope2) { 1.238 - value = 11; 1.239 - i++; 1.240 - if ((i & 1) != 0) { 1.241 - print("break"); 1.242 - break outer; 1.243 - } 1.244 - } 1.245 - } 1.246 - print(value); 1.247 - } 1.248 + var i=0; 1.249 + while (i < 10) { 1.250 + with(scope) { 1.251 + print("loop header "+i); 1.252 + with (scope2) { 1.253 + value = 11; 1.254 + i++; 1.255 + if ((i & 1) != 0) { 1.256 + print("break"); 1.257 + break outer; 1.258 + } 1.259 + } 1.260 + } 1.261 + print(value); 1.262 + } 1.263 } 1.264 } 1.265 1.266 @@ -218,32 +218,32 @@ 1.267 function test7() { 1.268 var value = "hello"; 1.269 var scope = {value:10}; 1.270 - var scope2 = {value:20}; 1.271 + var scope2 = {value:20}; 1.272 var global = false; 1.273 try { 1.274 - with(scope) { 1.275 - try { 1.276 - print(value); 1.277 - value = 4711; 1.278 - print(value); 1.279 - with(scope2) { 1.280 - print(value); 1.281 - value = 17; 1.282 - print(value); 1.283 - global = true; 1.284 - throw "inner"; 1.285 - } 1.286 - } catch (ei) { 1.287 - print(ei); 1.288 - print(value); 1.289 - if (global) { 1.290 - throw "outer"; 1.291 - } 1.292 - } 1.293 - } 1.294 + with(scope) { 1.295 + try { 1.296 + print(value); 1.297 + value = 4711; 1.298 + print(value); 1.299 + with(scope2) { 1.300 + print(value); 1.301 + value = 17; 1.302 + print(value); 1.303 + global = true; 1.304 + throw "inner"; 1.305 + } 1.306 + } catch (ei) { 1.307 + print(ei); 1.308 + print(value); 1.309 + if (global) { 1.310 + throw "outer"; 1.311 + } 1.312 + } 1.313 + } 1.314 } catch (eo) { 1.315 - print(eo); 1.316 - print(value); 1.317 + print(eo); 1.318 + print(value); 1.319 } 1.320 print(value); 1.321 }