summaryrefslogtreecommitdiffstats
path: root/tests/clock.test
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-09 07:57:32 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-07-09 07:57:32 (GMT)
commitf77d355196ec60d248464b6b78b6b4f227ee82ae (patch)
tree9f5c1165f40469633037a272e64bb9da4a6f138d /tests/clock.test
parent1dfea026b838bf256caed3e3266f5d310f289a35 (diff)
downloadtcl-f77d355196ec60d248464b6b78b6b4f227ee82ae.zip
tcl-f77d355196ec60d248464b6b78b6b4f227ee82ae.tar.gz
tcl-f77d355196ec60d248464b6b78b6b4f227ee82ae.tar.bz2
Proposed fix for [5019748c73]: FreeScan resp. Oldscan does not recognize positive time zone offset like "31 Jan 14 23:59:59 +0100"
Diffstat (limited to 'tests/clock.test')
-rw-r--r--tests/clock.test101
1 files changed, 64 insertions, 37 deletions
diff --git a/tests/clock.test b/tests/clock.test
index f7da08f..a3498e8 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -254,7 +254,6 @@ proc ::testClock::registry { cmd path key } {
return [dict get $reg $path $key]
}
-
# Test some of the basics of [clock format]
test clock-1.0 "clock format - wrong # args" {
@@ -35635,7 +35634,6 @@ test clock-34.11 {clock scan tests} {
set time [clock scan "1/1/37" -gmt true]
clock format $time -format {%b %d,%Y %H:%M GMT} -gmt true
} {Jan 01,2037 00:00 GMT}
-
test clock-34.12 {clock scan, relative times} {
set time [clock scan "Oct 23, 1992 -1 day"]
clock format $time -format {%b %d, %Y}
@@ -35664,30 +35662,6 @@ test clock-34.18 {clock scan, ISO 8601 point in time format} {
set time [clock scan "19921023T000000"]
clock format $time -format {%b %d, %Y %H:%M:%S}
} "Oct 23, 1992 00:00:00"
-test clock-34.19 {clock scan, ISO 8601 point in time format} {
- set time [clock scan "19921023T00:00:00"]
- clock format $time -format {%b %d, %Y %H:%M:%S}
-} "Oct 23, 1992 00:00:00"
-test clock-34.20 {clock scan, ISO 8601 point in time format} {
- set time [clock scan "1992-10-23T00:00:00"]
- clock format $time -format {%b %d, %Y %H:%M:%S}
-} "Oct 23, 1992 00:00:00"
-test clock-34.21 {clock scan, ISO 8601 invalid TZ} -body {
- set time [clock scan "19921023MST000000"]
- clock format $time -format {%b %d, %Y %H:%M:%S}
-} -returnCodes error -match glob -result {unable to convert date-time string*}
-test clock-34.22 {clock scan, ISO 8601 invalid TZ} -body {
- set time [clock scan "19921023M000000"]
- clock format $time -format {%b %d, %Y %H:%M:%S}
-} -returnCodes error -match glob -result {unable to convert date-time string*}
-test clock-34.23 {clock scan, ISO 8601 invalid TZ} -body {
- set time [clock scan "1992-10-23M00:00:00"]
- clock format $time -format {%b %d, %Y %H:%M:%S}
-} -returnCodes error -match glob -result {unable to convert date-time string*}
-test clock-34.24 {clock scan, ISO 8601 invalid TZ} -body {
- set time [clock scan "1992-10-23MST00:00:00"]
- clock format $time -format {%b %d, %Y %H:%M:%S}
-} -returnCodes error -match glob -result {unable to convert date-time string*}
# CLOCK SCAN REAL TESTS
# We use 5am PST, 31-12-1999 as the base for these scans because irrespective
@@ -35811,7 +35785,6 @@ test clock-34.43 {last monday in november} {
}
set res
} {1991-11-25 1992-11-30 1993-11-29 1994-11-28 1995-11-27 1996-11-25}
-
test clock-34.44 {2nd monday in november} {
set res {}
foreach i {91 92 93 94 95 96} {
@@ -35844,38 +35817,95 @@ test clock-34.47 {ago with multiple relative units} {
set res [clock scan "2 days 2 hours ago" -base $base]
expr {$base - $res}
} 180000
-
test clock-34.48 {more than one ToD} {*}{
-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}}
-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}}
-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}}
-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}}
-returnCodes error
-result {unable to convert date-time string "next January next March": more than one ordinal month in string}
}
-
-
+test clock-34.53 {clock scan, ISO 8601 point in time format} {
+ set time [clock scan "19921023T00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} "Oct 23, 1992 00:00:00"
+test clock-34.54 {clock scan, ISO 8601 point in time format} {
+ set time [clock scan "1992-10-23T00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} "Oct 23, 1992 00:00:00"
+test clock-34.55 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "19921023MST000000"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.56 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "19921023M000000"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.57 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "1992-10-23M00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.58 {clock scan, ISO 8601 invalid TZ} -body {
+ set time [clock scan "1992-10-23MST00:00:00"]
+ clock format $time -format {%b %d, %Y %H:%M:%S}
+} -returnCodes error -match glob -result {unable to convert date-time string*}
+test clock-34.59 {clock scan tests (-TZ)} {
+ set time [clock scan "31 Jan 14 23:59:59 -0100"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Feb 01,2014 00:59:59 GMT}
+test clock-34.60 {clock scan tests (+TZ)} {
+ set time [clock scan "31 Jan 14 23:59:59 +0100"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 31,2014 22:59:59 GMT}
+test clock-34.61 {clock scan tests (-TZ)} {
+ set time [clock scan "23:59:59 -0100" -base 0]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 02,1970 00:59:59 GMT}
+test clock-34.62 {clock scan tests (+TZ)} {
+ set time [clock scan "23:59:59 +0100" -base 0]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 01,1970 22:59:59 GMT}
+test clock-34.63 {clock scan tests (TZ)} {
+ set time [clock scan "Mon, 30 Jun 2014 23:59:59 CEST"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jun 30,2014 21:59:59 GMT}
+test clock-34.64 {clock scan tests (TZ)} {
+ set time [clock scan "Fri, 31 Jan 2014 23:59:59 CET"]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 31,2014 22:59:59 GMT}
+test clock-34.65 {clock scan tests (relspec, day unit not TZ)} {
+ set time [clock scan "23:59:59 +15 day" -base 2000000]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Feb 08,1970 22:59:59 GMT}
+test clock-34.66 {clock scan tests (relspec, day unit not TZ)} {
+ set time [clock scan "23:59:59 -15 day" -base 2000000]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 09,1970 22:59:59 GMT}
+test clock-34.67 {clock scan tests (merid and TZ)} {
+ set time [clock scan "10:59 pm CET" -base 2000000]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 24,1970 21:59:00 GMT}
+test clock-34.68 {clock scan tests (merid and TZ)} {
+ set time [clock scan "10:59 pm +0100" -base 2000000]
+ clock format $time -format {%b %d,%Y %H:%M:%S %Z} -gmt true
+} {Jan 24,1970 21:59:00 GMT}
# clock seconds
test clock-35.1 {clock seconds tests} {
@@ -36975,12 +37005,10 @@ test clock-67.2 {Bug d19a30db57} -body {
# error, not segfault
tcl::clock::GetJulianDayFromEraYearMonthDay {} 2361222
} -returnCodes error -match glob -result *
-
test clock-67.3 {Bug d19a30db57} -body {
# error, not segfault
tcl::clock::GetJulianDayFromEraYearWeekDay {} 2361222
} -returnCodes error -match glob -result *
-
test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24]} -setup {
package require msgcat
set current [msgcat::mclocale]
@@ -36992,7 +37020,6 @@ test clock-67.4 {Change format %x output on global locale change [Bug 4a0c163d24
} -cleanup {
msgcat::mclocale $current
} -result {1 1}
-
test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]} -setup {
package require msgcat
set current [msgcat::mclocale]