--- old/test/nashorn/script/basic/JDK-8047369.js 2020-04-15 19:01:20.000000000 +0530 +++ /dev/null 2020-04-15 19:01:20.000000000 +0530 @@ -1,186 +0,0 @@ -/* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/** - * JDK-8047369: Add regression tests for passing test cases of JDK-8024971 - * - * @test - * @run - * @option -scripting - */ - -function makeFuncAndCall(code) { - Function(code)(); -} - -function makeFuncExpectError(code, ErrorType) { - try { - makeFuncAndCall(code); - } catch (e) { - if (! (e instanceof ErrorType)) { - fail(ErrorType.name + " expected, got " + e); - } - } -} - -function evalExpectError(code, ErrorType) { - try { - eval(code)(); - } catch (e) { - if (! (e instanceof ErrorType)) { - fail(ErrorType.name + " expected, got " + e); - } - } -} - -function evalExpectValue(code, value) { - if (eval(code) != value) { - fail("Expected " + value + " with eval of " + code); - } -} - -makeFuncAndCall("for(x.x in 0) {}"); -// bug JDK-8047357 -// makeFuncAndCall("switch((null >> x3)) { default: {var x; break ; }\nthrow x; }"); -makeFuncExpectError("switch(x) { case 8: break; case false: }", ReferenceError); -makeFuncAndCall("try { return true; } finally { return false; } "); -makeFuncAndCall("({ get 1e81(){} })"); -makeFuncAndCall("{var x, x3;try { return 0; } finally { return 3/0; } }"); -makeFuncExpectError("with(x ? 1e81 : (x2.constructor = 0.1)) {}", ReferenceError); -makeFuncAndCall("while(x-=1) {var x=0; }"); -makeFuncAndCall("while((x-=false) && 0) { var x = this; }"); -makeFuncAndCall("/*infloop*/while(x4-=x) var x, x4 = x1;"); -makeFuncAndCall("/*infloop*/L:while(x+=null) { this;var x = /x/g ; }"); -makeFuncAndCall("while((x1|=0.1) && 0) { var x1 = -0, functional; }"); -makeFuncAndCall("with({}) return (eval(\"arguments\"));"); - -evalExpectValue(<