Import Tcl-code 8.6.8
This commit is contained in:
111
tests/clock.test
111
tests/clock.test
@@ -35,9 +35,9 @@ testConstraint y2038 \
|
||||
# TEST PLAN
|
||||
|
||||
# clock-1:
|
||||
# [clock format] - tests of bad and empty arguments
|
||||
# [clock format] - tests of bad and empty arguments
|
||||
#
|
||||
# clock-2
|
||||
# clock-2
|
||||
# formatting of year, month and day of month
|
||||
#
|
||||
# clock-3
|
||||
@@ -195,7 +195,7 @@ namespace eval ::tcl::clock {
|
||||
l li lii liii liv lv lvi lvii lviii lix
|
||||
lx lxi lxii lxiii lxiv lxv lxvi lxvii lxviii lxix
|
||||
lxx lxxi lxxii lxxiii lxxiv lxxv lxxvi lxxvii lxxviii lxxix
|
||||
lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii
|
||||
lxxx lxxxi lxxxii lxxxiii lxxxiv lxxxv lxxxvi lxxxvii lxxxviii
|
||||
lxxxix
|
||||
xc xci xcii xciii xciv xcv xcvi xcvii xcviii xcix
|
||||
c
|
||||
@@ -271,7 +271,7 @@ test clock-1.3 "clock format - empty val" {
|
||||
test clock-1.4 "clock format - bad flag" {*}{
|
||||
-body {
|
||||
list [catch {clock format 0 -oops badflag} msg] $msg $::errorCode
|
||||
}
|
||||
}
|
||||
-match glob
|
||||
-result {1 {bad option "-oops": must be -format, -gmt, -locale, or -timezone} {CLOCK badOption -oops}}
|
||||
}
|
||||
@@ -15416,30 +15416,9 @@ test clock-5.29 {time zone boundary case 1948-09-26 01:00:01} detroit {
|
||||
clock format -671047199 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {01:00:01 -0500 EST}
|
||||
test clock-5.30 {time zone boundary case 1967-06-14 01:59:59} detroit {
|
||||
clock format -80499601 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {01:59:59 -0500 EST}
|
||||
test clock-5.31 {time zone boundary case 1967-06-14 03:00:00} detroit {
|
||||
clock format -80499600 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {03:00:00 -0400 EDT}
|
||||
test clock-5.32 {time zone boundary case 1967-06-14 03:00:01} detroit {
|
||||
clock format -80499599 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {03:00:01 -0400 EDT}
|
||||
test clock-5.33 {time zone boundary case 1967-10-29 01:59:59} detroit {
|
||||
clock format -68666401 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {01:59:59 -0400 EDT}
|
||||
test clock-5.34 {time zone boundary case 1967-10-29 01:00:00} detroit {
|
||||
clock format -68666400 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {01:00:00 -0500 EST}
|
||||
test clock-5.35 {time zone boundary case 1967-10-29 01:00:01} detroit {
|
||||
clock format -68666399 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
} {01:00:01 -0500 EST}
|
||||
|
||||
# Detroit did not observe Daylight Saving Time in 1967
|
||||
|
||||
test clock-5.36 {time zone boundary case 1972-12-31 23:59:59} detroit {
|
||||
clock format 94712399 -format {%H:%M:%S %z %Z} \
|
||||
-timezone :America/Detroit
|
||||
@@ -35221,7 +35200,7 @@ test clock-30.25 {clock add seconds at DST conversion} {
|
||||
|
||||
test clock-31.1 {system locale} \
|
||||
-constraints win \
|
||||
-setup {
|
||||
-setup {
|
||||
namespace eval ::tcl::clock {
|
||||
namespace import -force ::testClock::registry
|
||||
}
|
||||
@@ -35244,7 +35223,7 @@ test clock-31.1 {system locale} \
|
||||
|
||||
test clock-31.2 {system locale} \
|
||||
-constraints win \
|
||||
-setup {
|
||||
-setup {
|
||||
namespace eval ::tcl::clock {
|
||||
namespace import -force ::testClock::registry
|
||||
}
|
||||
@@ -35267,7 +35246,7 @@ test clock-31.2 {system locale} \
|
||||
|
||||
test clock-31.3 {system locale} \
|
||||
-constraints win \
|
||||
-setup {
|
||||
-setup {
|
||||
namespace eval ::tcl::clock {
|
||||
namespace import -force ::testClock::registry
|
||||
}
|
||||
@@ -35290,7 +35269,7 @@ test clock-31.3 {system locale} \
|
||||
|
||||
test clock-31.4 {system locale} \
|
||||
-constraints win \
|
||||
-setup {
|
||||
-setup {
|
||||
namespace eval ::tcl::clock {
|
||||
namespace import -force ::testClock::registry
|
||||
}
|
||||
@@ -35327,7 +35306,7 @@ test clock-31.4 {system locale} \
|
||||
|
||||
test clock-31.5 {system locale} \
|
||||
-constraints win \
|
||||
-setup {
|
||||
-setup {
|
||||
namespace eval ::tcl::clock {
|
||||
namespace import -force ::testClock::registry
|
||||
}
|
||||
@@ -35364,7 +35343,7 @@ test clock-31.5 {system locale} \
|
||||
|
||||
test clock-31.6 {system locale} \
|
||||
-constraints win \
|
||||
-setup {
|
||||
-setup {
|
||||
namespace eval ::tcl::clock {
|
||||
namespace import -force ::testClock::registry
|
||||
}
|
||||
@@ -35434,7 +35413,7 @@ test clock-32.1 {scan/format across the Gregorian change} {
|
||||
}
|
||||
set problems
|
||||
} {}
|
||||
|
||||
|
||||
# Legacy tests
|
||||
|
||||
# clock clicks
|
||||
@@ -35468,7 +35447,7 @@ test clock-33.5 {clock clicks tests, millisecond timing test} {
|
||||
# 60 msecs seems to be the max time slice under Windows 95/98
|
||||
expr {
|
||||
($end > $start) && (($end - $start) <= 60) ?
|
||||
"ok" :
|
||||
"ok" :
|
||||
"test should have taken 0-60 ms, actually took [expr $end - $start]"}
|
||||
} {ok}
|
||||
test clock-33.5a {clock tests, millisecond timing test} {
|
||||
@@ -35480,7 +35459,7 @@ test clock-33.5a {clock tests, millisecond timing test} {
|
||||
# 60 msecs seems to be the max time slice under Windows 95/98
|
||||
expr {
|
||||
($end > $start) && (($end - $start) <= 60) ?
|
||||
"ok" :
|
||||
"ok" :
|
||||
"test should have taken 0-60 ms, actually took [expr $end - $start]"}
|
||||
} {ok}
|
||||
test clock-33.6 {clock clicks, milli with too much abbreviation} {
|
||||
@@ -35804,31 +35783,31 @@ test clock-34.47 {ago with multiple relative units} {
|
||||
} 180000
|
||||
|
||||
test clock-34.48 {more than one ToD} {*}{
|
||||
-body {clock scan {10:00 11:00}}
|
||||
-body {clock scan {10:00 11:00}}
|
||||
-returnCodes error
|
||||
-result {unable to convert date-time string "10:00 11:00": more than one time of day in string}
|
||||
}
|
||||
|
||||
test clock-34.49 {more than one date} {*}{
|
||||
-body {clock scan {1/1/2001 2/2/2002}}
|
||||
-body {clock scan {1/1/2001 2/2/2002}}
|
||||
-returnCodes error
|
||||
-result {unable to convert date-time string "1/1/2001 2/2/2002": more than one date in string}
|
||||
}
|
||||
|
||||
test clock-34.50 {more than one time zone} {*}{
|
||||
-body {clock scan {10:00 EST CST}}
|
||||
-body {clock scan {10:00 EST CST}}
|
||||
-returnCodes error
|
||||
-result {unable to convert date-time string "10:00 EST CST": more than one time zone in string}
|
||||
}
|
||||
|
||||
test clock-34.51 {more than one weekday} {*}{
|
||||
-body {clock scan {Monday Tuesday}}
|
||||
-body {clock scan {Monday Tuesday}}
|
||||
-returnCodes error
|
||||
-result {unable to convert date-time string "Monday Tuesday": more than one weekday in string}
|
||||
}
|
||||
|
||||
test clock-34.52 {more than one ordinal month} {*}{
|
||||
-body {clock scan {next January next March}}
|
||||
-body {clock scan {next January next March}}
|
||||
-returnCodes error
|
||||
-result {unable to convert date-time string "next January next March": more than one ordinal month in string}
|
||||
}
|
||||
@@ -35924,7 +35903,7 @@ test clock-38.2 {make sure TZ is not cached after unset} \
|
||||
}
|
||||
} \
|
||||
-result 1
|
||||
|
||||
|
||||
|
||||
test clock-39.1 {regression - synonym timezones} {
|
||||
clock format 0 -format {%H:%M:%S} -timezone :US/Eastern
|
||||
@@ -35996,7 +35975,7 @@ test clock-44.1 {regression test - time zone name containing hyphen } \
|
||||
}
|
||||
} \
|
||||
-result {12:34:56-0500}
|
||||
|
||||
|
||||
test clock-45.1 {regression test - time zone containing only two digits} \
|
||||
-body {
|
||||
clock scan 1985-04-12T10:15:30+04 -format %Y-%m-%dT%H:%M:%S%Z
|
||||
@@ -36041,7 +36020,7 @@ test clock-48.1 {Bug 1185933: 'i' destroyed by clock init} -setup {
|
||||
|
||||
test clock-49.1 {regression test - localtime with negative arg (Bug 1237907)} \
|
||||
-body {
|
||||
list [catch {
|
||||
list [catch {
|
||||
clock format -86400 -timezone :localtime -format %Y
|
||||
} result] $result
|
||||
} \
|
||||
@@ -36280,7 +36259,7 @@ test clock-56.1 {use of zoneinfo, version 1} {*}{
|
||||
}
|
||||
-result {2004-01-01 00:00:00 MST}
|
||||
}
|
||||
|
||||
|
||||
test clock-56.2 {use of zoneinfo, version 2} {*}{
|
||||
-setup {
|
||||
clock format [clock seconds]
|
||||
@@ -36330,7 +36309,7 @@ test clock-56.2 {use of zoneinfo, version 2} {*}{
|
||||
removeFile PhoenixTwo $tzdir2
|
||||
removeDirectory Test $tzdir
|
||||
removeDirectory zoneinfo
|
||||
}
|
||||
}
|
||||
-body {
|
||||
clock format 1072940400 -timezone :Test/PhoenixTwo \
|
||||
-format {%Y-%m-%d %H:%M:%S %Z}
|
||||
@@ -36540,7 +36519,7 @@ test clock-56.3 {use of zoneinfo, version 2, Y2038 compliance} {*}{
|
||||
removeFile TijuanaTwo $tzdir2
|
||||
removeDirectory Test $tzdir
|
||||
removeDirectory zoneinfo
|
||||
}
|
||||
}
|
||||
-body {
|
||||
clock format 2224738800 -timezone :Test/TijuanaTwo \
|
||||
-format {%Y-%m-%d %H:%M:%S %Z}
|
||||
@@ -36692,7 +36671,7 @@ test clock-56.4 {Bug 3470928} {*}{
|
||||
removeFile Windhoek $tzdir2
|
||||
removeDirectory Test $tzdir
|
||||
removeDirectory zoneinfo
|
||||
}
|
||||
}
|
||||
-result {Sun Jan 08 22:30:06 WAST 2012}
|
||||
}
|
||||
|
||||
@@ -36703,7 +36682,7 @@ test clock-57.1 {clock scan - abbreviated options} {
|
||||
test clock-58.1 {clock l10n - Japanese localisation} {*}{
|
||||
-setup {
|
||||
proc backslashify { string } {
|
||||
|
||||
|
||||
set retval {}
|
||||
foreach char [split $string {}] {
|
||||
scan $char %c ccode
|
||||
@@ -36809,52 +36788,52 @@ test clock-59.1 {military time zones} {
|
||||
|
||||
test clock-60.1 {case insensitive weekday names} {
|
||||
clock scan "2000-W01 monday" -gmt true -format "%G-W%V %a"
|
||||
} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"]
|
||||
} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"]
|
||||
test clock-60.2 {case insensitive weekday names} {
|
||||
clock scan "2000-W01 Monday" -gmt true -format "%G-W%V %a"
|
||||
} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"]
|
||||
} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"]
|
||||
test clock-60.3 {case insensitive weekday names} {
|
||||
clock scan "2000-W01 MONDAY" -gmt true -format "%G-W%V %a"
|
||||
} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"]
|
||||
} [clock scan "2000-W01-1" -gmt true -format "%G-W%V-%u"]
|
||||
test clock-60.4 {case insensitive weekday names} {
|
||||
clock scan "2000-W01 friday" -gmt true -format "%G-W%V %a"
|
||||
} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"]
|
||||
} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"]
|
||||
test clock-60.5 {case insensitive weekday names} {
|
||||
clock scan "2000-W01 Friday" -gmt true -format "%G-W%V %a"
|
||||
} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"]
|
||||
} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"]
|
||||
test clock-60.6 {case insensitive weekday names} {
|
||||
clock scan "2000-W01 FRIDAY" -gmt true -format "%G-W%V %a"
|
||||
} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"]
|
||||
} [clock scan "2000-W01-5" -gmt true -format "%G-W%V-%u"]
|
||||
test clock-60.7 {case insensitive month names} {
|
||||
clock scan "1 january 2000" -gmt true -format "%d %b %Y"
|
||||
} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"]
|
||||
} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"]
|
||||
test clock-60.8 {case insensitive month names} {
|
||||
clock scan "1 January 2000" -gmt true -format "%d %b %Y"
|
||||
} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"]
|
||||
} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"]
|
||||
test clock-60.9 {case insensitive month names} {
|
||||
clock scan "1 JANUARY 2000" -gmt true -format "%d %b %Y"
|
||||
} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"]
|
||||
} [clock scan "2000-01-01" -gmt true -format "%Y-%m-%d"]
|
||||
test clock-60.10 {case insensitive month names} {
|
||||
clock scan "1 december 2000" -gmt true -format "%d %b %Y"
|
||||
} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"]
|
||||
} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"]
|
||||
test clock-60.11 {case insensitive month names} {
|
||||
clock scan "1 December 2000" -gmt true -format "%d %b %Y"
|
||||
} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"]
|
||||
} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"]
|
||||
test clock-60.12 {case insensitive month names} {
|
||||
clock scan "1 DECEMBER 2000" -gmt true -format "%d %b %Y"
|
||||
} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"]
|
||||
} [clock scan "2000-12-01" -gmt true -format "%Y-%m-%d"]
|
||||
|
||||
test clock-61.1 {overflow of a wide integer on output} {*}{
|
||||
-body {
|
||||
clock format 0x8000000000000000 -format %s -gmt true
|
||||
}
|
||||
}
|
||||
-result {integer value too large to represent}
|
||||
-returnCodes error
|
||||
}
|
||||
test clock-61.2 {overflow of a wide integer on output} {*}{
|
||||
-body {
|
||||
clock format -0x8000000000000001 -format %s -gmt true
|
||||
}
|
||||
}
|
||||
-result {integer value too large to represent}
|
||||
-returnCodes error
|
||||
}
|
||||
@@ -36954,10 +36933,10 @@ test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]}
|
||||
set current [msgcat::mclocale]
|
||||
} -body {
|
||||
msgcat::mclocale de_de
|
||||
set res [clock scan "01.01.1970" -locale current -format %x]
|
||||
set res [clock scan "01.01.1970" -locale current -format %x -gmt 1]
|
||||
msgcat::mclocale en_uk
|
||||
# This will fail without the bug fix, as still de_de is active
|
||||
expr {$res == [clock scan "01/01/1970" -locale current -format %x]}
|
||||
expr {$res == [clock scan "01/01/1970" -locale current -format %x -gmt 1]}
|
||||
} -cleanup {
|
||||
msgcat::mclocale $current
|
||||
} -result {1}
|
||||
|
||||
Reference in New Issue
Block a user