diff options
author | stanton <stanton> | 1998-09-21 23:39:52 (GMT) |
---|---|---|
committer | stanton <stanton> | 1998-09-21 23:39:52 (GMT) |
commit | 494c2de3a748b449c69ce322a1a741f5a31fd4d5 (patch) | |
tree | c3ece48c0ae3f4ba54787e0e8e729b65752ef3f9 /tests/clock.test | |
parent | 7a698c0488d99c0af42022714638ae1ba2afaa49 (diff) | |
download | tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.zip tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.gz tcl-494c2de3a748b449c69ce322a1a741f5a31fd4d5.tar.bz2 |
Added contents of Tcl 8.1a2
Diffstat (limited to 'tests/clock.test')
-rw-r--r-- | tests/clock.test | 55 |
1 files changed, 44 insertions, 11 deletions
diff --git a/tests/clock.test b/tests/clock.test index 95f73ac..6af00ec 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -4,12 +4,12 @@ # built-in commands. Sourcing this file into Tcl runs the tests and # generates output for errors. No output means no errors were found. # -# Copyright (c) 1995-1997 Sun Microsystems, Inc. +# Copyright (c) 1995-1998 Sun Microsystems, Inc. # # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# SCCS: @(#) clock.test 1.17 97/11/24 15:05:38 +# SCCS: @(#) clock.test 1.22 98/02/02 22:03:36 if {[string compare test [info procs test]] == 1} then {source defs} @@ -41,29 +41,60 @@ test clock-3.1 {clock format tests} {unixOnly} { clock format $clockval -format {%a %b %d %I:%M:%S %p %Y} -gmt true } {Sun Nov 04 03:02:46 AM 1990} test clock-3.2 {clock format tests} { + # TCL_USE_TIMEZONE_VAR + + catch {set oldtz $env(TZ)} + set env(TZ) PST + set x {} + append x [clock format 863800000 -format %Z -gmt 1] + append x [set env(TZ)] + catch {unset env(TZ); set env(TZ) $oldtz} + set x +} {GMTPST} +test clock-3.3 {clock format tests} { + # tzset() under Borland doesn't seem to set up tzname[] for local + # timezone, which caused "clock format" to think that %Z was an invalid + # string. Don't care about answer, just that test runs w/o error. + + clock format 863800000 -format %Z + set x {} +} {} +test clock-3.4 {clock format tests} { + # tzset() under Borland doesn't seem to set up tzname[] for gmt timezone. + # tzset() under MSVC has the following weird observed behavior: + # First time we call "clock format [clock seconds] -format %Z -gmt 1" + # we get "GMT", but on all subsequent calls we get the current time + # zone string, even though env(TZ) is GMT and the variable _timezone + # is 0. + + set x {} + append x [clock format 863800000 -format %Z -gmt 1] + append x [clock format 863800000 -format %Z -gmt 1] +} {GMTGMT} +test clock-3.5 {clock format tests} { list [catch {clock format} msg] $msg } {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt boolean?"}} -test clock-3.3 {clock format tests} { +test clock-3.6 {clock format tests} { list [catch {clock format foo} msg] $msg } {1 {expected integer but got "foo"}} -test clock-3.4 {clock format tests} {unixOrPc} { +test clock-3.7 {clock format tests} {unixOrPc} { set clockval 657687766 clock format $clockval -format "%a %b %d %I:%M:%S %p %Y" -gmt true } "Sun Nov 04 03:02:46 AM 1990" -test clock-3.5 {clock format tests} { +test clock-3.8 {clock format tests} { list [catch {clock format a b c d e g} msg] $msg } {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt boolean?"}} -test clock-3.6 {clock format tests} {unixOrPc nonPortable} { +test clock-3.9 {clock format tests} {unixOrPc nonPortable} { set clockval -1 clock format $clockval -format "%a %b %d %I:%M:%S %p %Y" -gmt true } "Wed Dec 31 11:59:59 PM 1969" -test clock-3.7 {clock format tests} { +test clock-3.10 {clock format tests} { list [catch {clock format 123 -bad arg} msg] $msg -} {1 {bad switch "-bad": must be -format, or -gmt}} -test clock-3.8 {clock format tests} { +} {1 {bad switch "-bad": must be -format or -gmt}} +test clock-3.11 {clock format tests} { clock format 123 -format "x" } x -test clock-3.9 {clock format tests} { +test clock-3.12 {clock format tests} { clock format 123 -format "" } "" @@ -101,7 +132,7 @@ test clock-4.8 {clock scan tests} { } {Oct 23,1992 15:00 GMT} test clock-4.9 {clock scan tests} { list [catch {clock scan "Jan 12" -bad arg} msg] $msg -} {1 {bad switch "-bad": must be -base, or -gmt}} +} {1 {bad switch "-bad": must be -base or -gmt}} # The following two two tests test the two year date policy test clock-4.10 {clock scan tests} { set time [clock scan "1/1/71" -gmt true] @@ -173,3 +204,5 @@ test clock-6.11 {clock roll over dates} { set time [clock scan "March 1, 2001" -gmt true] clock format $time -format %j -gmt true } {060} + +return |