nashorn/test/script/basic/JDK-8019814.js
author psandoz
Tue, 13 Aug 2013 11:16:37 +0200
changeset 19424 c4524285927f
parent 18845 6bfb1bcec75e
child 24778 2ff5d7041566
permissions -rw-r--r--
8022797: Clarify spliterator characteristics for collections containing no elements Reviewed-by: alanb, mduigou
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18845
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     1
/*
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     2
 * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     4
 * 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     8
 * 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    13
 * accompanied this code).
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    14
 * 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    18
 * 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    21
 * questions.
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    22
 */
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    23
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    24
/**
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    25
 * JDK-8019814: Add regression test for passing cases
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    26
 *
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    27
 * @test
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    28
 * @run
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    29
 */
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    30
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    31
// java.lang.VerifyError: Bad type on operand stack
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    32
Function("switch([]) { case 7: }");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    33
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    34
// java.lang.AssertionError: expecting integer type or object for jump, but found double
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    35
Function("with(\nnull == (this % {}))( /x/g );");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    36
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    37
// java.lang.AssertionError: expecting equivalent types on stack but got double and int 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    38
try {
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    39
    eval('Function("/*infloop*/while(((function ()4.)([z1,,], [,,]) - true++))switch(1e+81.x) { default: break; \u0009 }")');
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    40
} catch (e) {
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    41
    print(e.toString().replace(/\\/g, '/'));
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    42
}
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    43
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    44
// java.lang.VerifyError: get long/double overflows locals
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    45
Function("var x = x -= '' ");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    46
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    47
// java.lang.AssertionError: object is not compatible with boolean
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    48
Function("return (null != [,,] <= this);");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    49
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    50
// java.lang.AssertionError: Only return value on stack allowed at return point
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    51
// - depth=2 stack = jdk.nashorn.internal.codegen.Label$Stack@4bd0d62f 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    52
Function("x = 0.1, x\ntrue\n~this");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    53
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    54
// java.lang.AssertionError: node NaN ~ window class jdk.nashorn.internal.ir.BinaryNode
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    55
// has no symbol! [object] function _L1() 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    56
Function("throw NaN\n~window;");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    57
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    58
// java.lang.AssertionError: array element type doesn't match array type
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    59
Function("if(([(this >>> 4.)].map(gc))) x;");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    60
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    61
try {
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    62
    eval('Function("if(--) y;")');
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    63
} catch (e) {
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    64
    print(e.toString().replace(/\\/g, '/'));
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    65
}
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    66
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    67
// java.lang.AssertionError: stacks jdk.nashorn.internal.codegen.Label$Stack@4918f90f
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    68
// is not equivalent with jdk.nashorn.internal.codegen.Label$Stack@5f9b21a1 at join point 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    69
Function("if((null ^ [1]) !== (this.yoyo(false))) {var NaN, x;x\n~[,,z1] }");
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    70
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    71
// java.lang.AssertionError
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    72
//    at jdk.nashorn.internal.codegen.Attr.enterFunctionBody(Attr.java:276) 
6bfb1bcec75e 8019814: Add regression test for passing cases
sundar
parents:
diff changeset
    73
Function("return (void ({ set each (x2)y }));");