Wed, 03 Jul 2013 19:20:29 +0530
8019814: Add regression test for passing cases
Reviewed-by: jlaskey, lagergren
1.1 --- a/src/jdk/nashorn/internal/runtime/ListAdapter.java Wed Jul 03 15:46:03 2013 +0200 1.2 +++ b/src/jdk/nashorn/internal/runtime/ListAdapter.java Wed Jul 03 19:20:29 2013 +0530 1.3 @@ -1,3 +1,28 @@ 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 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. Oracle designates this 1.11 + * particular file as subject to the "Classpath" exception as provided 1.12 + * by Oracle in the LICENSE file that accompanied this code. 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 + * You should have received a copy of the GNU General Public License version 1.21 + * 2 along with this work; if not, write to the Free Software Foundation, 1.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.23 + * 1.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.25 + * or visit www.oracle.com if you need additional information or have any 1.26 + * questions. 1.27 + */ 1.28 + 1.29 package jdk.nashorn.internal.runtime; 1.30 1.31 import java.util.AbstractList;
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/script/basic/JDK-8019814.js Wed Jul 03 19:20:29 2013 +0530 2.3 @@ -0,0 +1,73 @@ 2.4 +/* 2.5 + * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 + * 2.8 + * This code is free software; you can redistribute it and/or modify it 2.9 + * under the terms of the GNU General Public License version 2 only, as 2.10 + * published by the Free Software Foundation. 2.11 + * 2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 + * version 2 for more details (a copy is included in the LICENSE file that 2.16 + * accompanied this code). 2.17 + * 2.18 + * You should have received a copy of the GNU General Public License version 2.19 + * 2 along with this work; if not, write to the Free Software Foundation, 2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 + * 2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 + * or visit www.oracle.com if you need additional information or have any 2.24 + * questions. 2.25 + */ 2.26 + 2.27 +/** 2.28 + * JDK-8019814: Add regression test for passing cases 2.29 + * 2.30 + * @test 2.31 + * @run 2.32 + */ 2.33 + 2.34 +// java.lang.VerifyError: Bad type on operand stack 2.35 +Function("switch([]) { case 7: }"); 2.36 + 2.37 +// java.lang.AssertionError: expecting integer type or object for jump, but found double 2.38 +Function("with(\nnull == (this % {}))( /x/g );"); 2.39 + 2.40 +// java.lang.AssertionError: expecting equivalent types on stack but got double and int 2.41 +try { 2.42 + eval('Function("/*infloop*/while(((function ()4.)([z1,,], [,,]) - true++))switch(1e+81.x) { default: break; \u0009 }")'); 2.43 +} catch (e) { 2.44 + print(e.toString().replace(/\\/g, '/')); 2.45 +} 2.46 + 2.47 +// java.lang.VerifyError: get long/double overflows locals 2.48 +Function("var x = x -= '' "); 2.49 + 2.50 +// java.lang.AssertionError: object is not compatible with boolean 2.51 +Function("return (null != [,,] <= this);"); 2.52 + 2.53 +// java.lang.AssertionError: Only return value on stack allowed at return point 2.54 +// - depth=2 stack = jdk.nashorn.internal.codegen.Label$Stack@4bd0d62f 2.55 +Function("x = 0.1, x\ntrue\n~this"); 2.56 + 2.57 +// java.lang.AssertionError: node NaN ~ window class jdk.nashorn.internal.ir.BinaryNode 2.58 +// has no symbol! [object] function _L1() 2.59 +Function("throw NaN\n~window;"); 2.60 + 2.61 +// java.lang.AssertionError: array element type doesn't match array type 2.62 +Function("if(([(this >>> 4.)].map(gc))) x;"); 2.63 + 2.64 +try { 2.65 + eval('Function("if(--) y;")'); 2.66 +} catch (e) { 2.67 + print(e.toString().replace(/\\/g, '/')); 2.68 +} 2.69 + 2.70 +// java.lang.AssertionError: stacks jdk.nashorn.internal.codegen.Label$Stack@4918f90f 2.71 +// is not equivalent with jdk.nashorn.internal.codegen.Label$Stack@5f9b21a1 at join point 2.72 +Function("if((null ^ [1]) !== (this.yoyo(false))) {var NaN, x;x\n~[,,z1] }"); 2.73 + 2.74 +// java.lang.AssertionError 2.75 +// at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276) 2.76 +Function("return (void ({ set each (x2)y }));");
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/script/basic/JDK-8019814.js.EXPECTED Wed Jul 03 19:20:29 2013 +0530 3.3 @@ -0,0 +1,6 @@ 3.4 +ReferenceError: <function>:1:50 Invalid left hand side for assignment 3.5 +/*infloop*/while(((function ()4.)([z1,,], [,,]) - true++))switch(1e+81.x) { default: break; } 3.6 + ^ 3.7 +SyntaxError: <function>:1:5 Expected l-value but found ) 3.8 +if(--) y; 3.9 + ^