diff options
author | sebres <sebres@users.sourceforge.net> | 2024-03-12 01:21:47 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2024-03-12 01:21:47 (GMT) |
commit | ec9410157e93cbeb66c19fcffc9f31b291d1a01b (patch) | |
tree | 9d3a108284843a3cc286bec4c3e4a3bf1cd15866 /tests | |
parent | dc7fb8c3608b04ed8213454381b89f2e181dc920 (diff) | |
download | tcl-ec9410157e93cbeb66c19fcffc9f31b291d1a01b.zip tcl-ec9410157e93cbeb66c19fcffc9f31b291d1a01b.tar.gz tcl-ec9410157e93cbeb66c19fcffc9f31b291d1a01b.tar.bz2 |
tests to ensure cache of base is correct for :localtime if TZ-env changing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/clock.test | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/clock.test b/tests/clock.test index 9b9bc52..f4492b6 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -36828,6 +36828,52 @@ test clock-38.2 {make sure TZ is not cached after unset} \ } \ -result 1 +test clock-38.3sc {ensure cache of base is correct for :localtime if TZ-env changing / scan} \ + -setup { + if { [info exists env(TZ)] } { + set oldTZ $env(TZ) + } + } \ + -body { + set res {} + foreach env(TZ) {GMT-11:30 GMT-07:30 GMT-03:30 GMT} \ + i {{07:30:00} {03:30:00} {23:30:00} {20:00:00}} \ + { + lappend res [clock scan $i -format "%H:%M:%S" -base [expr {20*60*60}] -timezone :localtime] + } + set res + } \ + -cleanup { + if { [info exists oldTZ] } { + set env(TZ) $oldTZ + unset oldTZ + } else { + unset env(TZ) + } + } \ + -result [lrepeat 4 [expr {20*60*60}]] +test clock-38.3fm {ensure cache of base is correct for :localtime if TZ-env changing / format} \ + -setup { + if { [info exists env(TZ)] } { + set oldTZ $env(TZ) + } + } \ + -body { + set res {} + foreach env(TZ) {GMT-11:30 GMT-07:30 GMT-03:30 GMT} { + lappend res [clock format [expr {20*60*60}] -format "%Y-%m-%dT%H:%M:%S %Z" -timezone :localtime] + } + set res + } \ + -cleanup { + if { [info exists oldTZ] } { + set env(TZ) $oldTZ + unset oldTZ + } else { + unset env(TZ) + } + } \ + -result {{1970-01-02T07:30:00 +1130} {1970-01-02T03:30:00 +0730} {1970-01-01T23:30:00 +0330} {1970-01-01T20:00:00 +0000}} test clock-39.1 {regression - synonym timezones} { clock format 0 -format {%H:%M:%S} -timezone :US/Eastern |