test/script/basic/JDK-8019814.js

Fri, 05 Jun 2015 12:38:53 +0200

author
mhaupt
date
Fri, 05 Jun 2015 12:38:53 +0200
changeset 1398
2f1b9f4daec1
parent 962
ac62e33a99b0
permissions
-rw-r--r--

8080087: Nashorn $ENV.PWD is originally undefined
Summary: On Windows, the PWD environment variable does not exist and cannot be imported in scripting mode, so it is set explicitly.
Reviewed-by: lagergren, sundar

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

mercurial