jjs-option-scripting.js revision 1648:25b13597ea73
1215976Sjmallett/* 2232812Sjmallett * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 3215976Sjmallett * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4215976Sjmallett * 5215976Sjmallett * This code is free software; you can redistribute it and/or modify it 6215976Sjmallett * under the terms of the GNU General Public License version 2 only, as 7215976Sjmallett * published by the Free Software Foundation. 8215976Sjmallett * 9215976Sjmallett * This code is distributed in the hope that it will be useful, but WITHOUT 10215976Sjmallett * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11215976Sjmallett * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12215976Sjmallett * version 2 for more details (a copy is included in the LICENSE file that 13215976Sjmallett * accompanied this code). 14215976Sjmallett * 15215976Sjmallett * You should have received a copy of the GNU General Public License version 16215976Sjmallett * 2 along with this work; if not, write to the Free Software Foundation, 17215976Sjmallett * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18232812Sjmallett * 19215976Sjmallett * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20215976Sjmallett * or visit www.oracle.com if you need additional information or have any 21215976Sjmallett * questions. 22215976Sjmallett */ 23215976Sjmallett 24215976Sjmallett/** 25215976Sjmallett * JDK-8144113: Nashorn: enable jjs testing. 26215976Sjmallett * @test 27215976Sjmallett * @option -scripting 28215976Sjmallett * @run 29232812Sjmallett * @summary Test -scripting flag and its basic functionality 30215976Sjmallett */ 31215976Sjmallett 32215976Sjmallettload(__DIR__ + "jjs-common.js") 33215976Sjmallett 34215976Sjmallett// code to check -flag 35215976Sjmallettvar msg_flag = "print($OPTIONS._scripting)" 36215976Sjmallett 37215976Sjmallett// code to check basic functionality 38215976Sjmallettvar msg_func = <<'EOD' 39215976Sjmallettvar x = "Nashorn" 40215976Sjmallettvar hello = "Hello ${x}" 41215976Sjmallettif (hello != "Hello Nashorn") { 42215976Sjmallett throw new Error("string interploation not working") 43215976Sjmallett} 44215976SjmallettEOD 45215976Sjmallett 46215976Sjmallett// flag test expected output variables 47215976Sjmallettvar e_outn = 'ReferenceErrorr: "$OPTIONS" is not defined' 48215976Sjmallett// negative flag test condition 49215976Sjmallettvar flag_cond_n = 'err.indexOf("$OPTIONS") > -1' 50215976Sjmallett 51215976Sjmallett// functionality test arguments 52232812Sjmallettvar arg_p = "-scripting ${testfunc_file}" 53232812Sjmallettvar arg_n = "${testfunc_file}" 54215976Sjmallett 55215976Sjmallettvar args_p = "", 56215976Sjmallett args_n = "" 57215976Sjmallett 58215976Sjmallett// Testing starts here 59215976Sjmalletttestjjs_flag_and_func("-scripting", "") 60232812Sjmallett