test/script/basic/JDK-8019814.js

changeset 408
fcb484c43348
parent 0
b1a7da25b547
child 962
ac62e33a99b0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/script/basic/JDK-8019814.js	Wed Jul 03 19:20:29 2013 +0530
     1.3 @@ -0,0 +1,73 @@
     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.
    1.11 + * 
    1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    1.15 + * version 2 for more details (a copy is included in the LICENSE file that
    1.16 + * accompanied this code).
    1.17 + * 
    1.18 + * You should have received a copy of the GNU General Public License version
    1.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    1.21 + * 
    1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    1.23 + * or visit www.oracle.com if you need additional information or have any
    1.24 + * questions.
    1.25 + */
    1.26 +
    1.27 +/**
    1.28 + * JDK-8019814: Add regression test for passing cases
    1.29 + *
    1.30 + * @test
    1.31 + * @run
    1.32 + */
    1.33 +
    1.34 +// java.lang.VerifyError: Bad type on operand stack
    1.35 +Function("switch([]) { case 7: }");
    1.36 +
    1.37 +// java.lang.AssertionError: expecting integer type or object for jump, but found double
    1.38 +Function("with(\nnull == (this % {}))( /x/g );");
    1.39 +
    1.40 +// java.lang.AssertionError: expecting equivalent types on stack but got double and int 
    1.41 +try {
    1.42 +    eval('Function("/*infloop*/while(((function ()4.)([z1,,], [,,]) - true++))switch(1e+81.x) { default: break; \u0009 }")');
    1.43 +} catch (e) {
    1.44 +    print(e.toString().replace(/\\/g, '/'));
    1.45 +}
    1.46 +
    1.47 +// java.lang.VerifyError: get long/double overflows locals
    1.48 +Function("var x = x -= '' ");
    1.49 +
    1.50 +// java.lang.AssertionError: object is not compatible with boolean
    1.51 +Function("return (null != [,,] <= this);");
    1.52 +
    1.53 +// java.lang.AssertionError: Only return value on stack allowed at return point
    1.54 +// - depth=2 stack = jdk.nashorn.internal.codegen.Label$Stack@4bd0d62f 
    1.55 +Function("x = 0.1, x\ntrue\n~this");
    1.56 +
    1.57 +// java.lang.AssertionError: node NaN ~ window class jdk.nashorn.internal.ir.BinaryNode
    1.58 +// has no symbol! [object] function _L1() 
    1.59 +Function("throw NaN\n~window;");
    1.60 +
    1.61 +// java.lang.AssertionError: array element type doesn't match array type
    1.62 +Function("if(([(this >>> 4.)].map(gc))) x;");
    1.63 +
    1.64 +try {
    1.65 +    eval('Function("if(--) y;")');
    1.66 +} catch (e) {
    1.67 +    print(e.toString().replace(/\\/g, '/'));
    1.68 +}
    1.69 +
    1.70 +// java.lang.AssertionError: stacks jdk.nashorn.internal.codegen.Label$Stack@4918f90f
    1.71 +// is not equivalent with jdk.nashorn.internal.codegen.Label$Stack@5f9b21a1 at join point 
    1.72 +Function("if((null ^ [1]) !== (this.yoyo(false))) {var NaN, x;x\n~[,,z1] }");
    1.73 +
    1.74 +// java.lang.AssertionError
    1.75 +//    at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276) 
    1.76 +Function("return (void ({ set each (x2)y }));"); 

mercurial