test/script/basic/JDK-8081156.js

Wed, 27 May 2015 22:18:51 +0530

author
sundar
date
Wed, 27 May 2015 22:18:51 +0530
changeset 1379
01491258b920
child 1482
58791cd01bc9
permissions
-rw-r--r--

8081156: jjs "nashorn.args" system property is not effective when script arguments are passed
Reviewed-by: hannesw, lagergren

sundar@1379 1 /*
sundar@1379 2 * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
sundar@1379 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
sundar@1379 4 *
sundar@1379 5 * This code is free software; you can redistribute it and/or modify it
sundar@1379 6 * under the terms of the GNU General Public License version 2 only, as
sundar@1379 7 * published by the Free Software Foundation.
sundar@1379 8 *
sundar@1379 9 * This code is distributed in the hope that it will be useful, but WITHOUT
sundar@1379 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
sundar@1379 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
sundar@1379 12 * version 2 for more details (a copy is included in the LICENSE file that
sundar@1379 13 * accompanied this code).
sundar@1379 14 *
sundar@1379 15 * You should have received a copy of the GNU General Public License version
sundar@1379 16 * 2 along with this work; if not, write to the Free Software Foundation,
sundar@1379 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
sundar@1379 18 *
sundar@1379 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
sundar@1379 20 * or visit www.oracle.com if you need additional information or have any
sundar@1379 21 * questions.
sundar@1379 22 */
sundar@1379 23
sundar@1379 24 /**
sundar@1379 25 * JDK-8081156: jjs "nashorn.args" system property is not effective when script arguments are passed
sundar@1379 26 *
sundar@1379 27 * @test
sundar@1379 28 * @fork
sundar@1379 29 * @option -Dnashorn.args=-strict
sundar@1379 30 * @argument foo
sundar@1379 31 * @argument bar
sundar@1379 32 * @run
sundar@1379 33 */
sundar@1379 34
sundar@1379 35 try {
sundar@1379 36 x = 14;
sundar@1379 37 throw new Error("should have thrown ReferenceError");
sundar@1379 38 } catch (e) {
sundar@1379 39 if (! (e instanceof ReferenceError)) {
sundar@1379 40 throw e;
sundar@1379 41 }
sundar@1379 42 }
sundar@1379 43
sundar@1379 44 Assert.assertTrue(arguments.length == 2);
sundar@1379 45 Assert.assertTrue(arguments[0] == "foo");
sundar@1379 46 Assert.assertTrue(arguments[1] == "bar");

mercurial