jjs-option-cp.js revision 1603:086c19a36be6
1279377Simp/* 2279377Simp * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3279377Simp * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4279377Simp * 5279377Simp * This code is free software; you can redistribute it and/or modify it 6279377Simp * under the terms of the GNU General Public License version 2 only, as 7279377Simp * published by the Free Software Foundation. 8279377Simp * 9279377Simp * This code is distributed in the hope that it will be useful, but WITHOUT 10279377Simp * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11279377Simp * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12279377Simp * version 2 for more details (a copy is included in the LICENSE file that 13279377Simp * accompanied this code). 14279377Simp * 15279377Simp * You should have received a copy of the GNU General Public License version 16279377Simp * 2 along with this work; if not, write to the Free Software Foundation, 17279377Simp * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18279377Simp * 19279377Simp * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20279377Simp * or visit www.oracle.com if you need additional information or have any 21279377Simp * questions. 22279377Simp */ 23279377Simp 24279377Simp/** 25279377Simp * JDK-8144113: Nashorn: enable jjs testing. 26279377Simp * @test 27279377Simp * @option -scripting 28279377Simp * @runif os.not.windows 29279377Simp * @run 30279377Simp * @summary Test to check if -cp flag and its basic functionality 31279377Simp */ 32279377Simp 33279377Simpload(__DIR__ + "jjs-common.js") 34279377Simp 35279377Simpvar hello = __DIR__ + "Hello.class"; 36279377Simpvar helloj = __DIR__ + "Hello.java"; 37279377Simp 38279377Simp// code to check -flag 39279377Simpvar msg_flag = "print($OPTIONS._classpath)" 40279377Simp 41279377Simp// code to check basic functionality 42279377Simpvar msg_func = <<EOD 43279377Simp$EXEC("rm -f ${hello}") 44279377Simp$EXEC("${javac} ${helloj}") 45279377Simpvar v = new Packages.Hello(); 46279377Simpif (v.string != 'hello') { 47279377Simp throw new Error("Unexpected property value"); 48279377Simp} 49279377SimpEOD 50279377Simp 51279377Simp// flag test expected output variables 52279377Simpvar e_outp = "__DIR__" 53279377Simpvar e_outn = "null" 54279377Simp 55279377Simp// functionality test arguments 56279377Simpvar arg_p = "-scripting -cp ${__DIR__} ${testfunc_file}" 57279377Simpvar arg_n = "-scripting ${testfunc_file}" 58279377Simp 59279377Simp// Testing starts here 60279377Simptestjjs_flag_and_func("-cp", " __DIR__") 61279377Simp$EXEC("rm -f ${hello}") 62279377Simp