test/nashorn/script/nosecurity/jjs-option-t.js
author pmuthuswamy
Wed, 24 Jan 2018 11:29:01 +0530
changeset 48658 11f8b31b02c1
permissions -rw-r--r--
8147614: add jjs test for -t option Reviewed-by: hannesw, jlaskey, sundar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
48658
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     1
/*
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     4
 *
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     7
 * published by the Free Software Foundation.
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     8
 *
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    13
 * accompanied this code).
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    14
 *
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    18
 *
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    21
 * questions.
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    22
 */
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    23
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    24
/**
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    25
 * JDK-8147614: add jjs test for -t option.
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    26
 * @test
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    27
 * @option -scripting
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    28
 * @run
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    29
 * @summary Test -t flag and its basic functionality
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    30
 */
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    31
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    32
load(__DIR__ + "jjs-common.js")
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    33
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    34
var timezone = Java.type("java.util.TimeZone")
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    35
var currentTimezone = timezone.getDefault().getID()
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    36
var msg_flag = "print($OPTIONS._timezone.ID)"
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    37
var e_outp = "Asia/Tokyo"
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    38
var e_outn = currentTimezone
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    39
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    40
var msg_func=<<EOD
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    41
var d= new Date(0)
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    42
print(d.getTimezoneOffset())
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    43
EOD
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    44
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    45
var func_cond_p = <<'EOD'
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    46
out==-540
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    47
EOD
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    48
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    49
var func_cond_n = <<'EOD'
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    50
out==-timezone.getDefault().getRawOffset()/60000
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    51
EOD
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    52
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    53
var arg_p = "-t=Asia/Tokyo ${testfunc_file}"
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    54
var arg_n = "${testfunc_file}"
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    55
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    56
testjjs_flag_and_func("-t","=Asia/Tokyo")
11f8b31b02c1 8147614: add jjs test for -t option
pmuthuswamy
parents:
diff changeset
    57