JDK-8081156.js revision 1365:833a4df84bc7
1311116Sdim/*
2311116Sdim * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
3353358Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4353358Sdim *
5353358Sdim * This code is free software; you can redistribute it and/or modify it
6311116Sdim * under the terms of the GNU General Public License version 2 only, as
7311116Sdim * published by the Free Software Foundation.
8311116Sdim *
9311116Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
10311116Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11311116Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12311116Sdim * version 2 for more details (a copy is included in the LICENSE file that
13311116Sdim * accompanied this code).
14311116Sdim *
15311116Sdim * You should have received a copy of the GNU General Public License version
16311116Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17311116Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18311116Sdim *
19311116Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20311116Sdim * or visit www.oracle.com if you need additional information or have any
21311116Sdim * questions.
22311116Sdim */
23311116Sdim
24311116Sdim/**
25311116Sdim * JDK-8081156: jjs "nashorn.args" system property is not effective when script arguments are passed
26311116Sdim *
27311116Sdim * @test
28311116Sdim * @fork
29312197Sdim * @option -Dnashorn.args=-strict
30311116Sdim * @argument foo
31312197Sdim * @argument bar
32311116Sdim * @run
33312197Sdim */
34311116Sdim
35312197Sdimtry {
36311116Sdim   x = 14;
37312197Sdim   throw new Error("should have thrown ReferenceError");
38311116Sdim} catch (e) {
39311116Sdim   if (! (e instanceof ReferenceError)) {
40312197Sdim       throw e;
41311116Sdim   }
42311116Sdim}
43311116Sdim
44311116SdimAssert.assertTrue(arguments.length == 2);
45311116SdimAssert.assertTrue(arguments[0] == "foo");
46311116SdimAssert.assertTrue(arguments[1] == "bar");
47311116Sdim