diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/clock.test | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/tests/clock.test b/tests/clock.test index 0aa65b6..35af1f0 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -11,7 +11,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: clock.test,v 1.76 2007/04/20 02:46:32 kennykb Exp $ +# RCS: @(#) $Id: clock.test,v 1.77 2007/04/20 03:50:21 kennykb Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -36519,6 +36519,44 @@ test clock-58.1 {clock l10n - Japanese localisation} {*}{ -result {} } +test clock-59.1 {military time zones} { + set hour 0 + set base [clock scan "20000101 000000" -format "%Y%m%d %H%M%S" -gmt 1] + set trouble {} + foreach {pzone mzone} { + Z Z A N B O C P D Q E R F S G T H U I V K W L X M Y + } { + catch {clock scan "20000101 000000 $pzone" \ + -format "%Y%m%d %H%M%S %Z"} ps1 + catch {clock scan "20000101 000000 $pzone"} ps2 + catch {clock scan "20000101 000000 $mzone" \ + -format "%Y%m%d %H%M%S %Z"} ms1 + catch {clock scan "20000101 000000 $mzone"} ms2 + if {$ps1 != $base - 3600 * $hour} { + lappend trouble [list pzone $pzone hour $hour ps1 is $ps1] + } + if {$ps2 != $base - 3600 * $hour} { + lappend trouble [list pzone $pzone ps2 is $ps2] + } + if {$ms1 != $base + 3600 * $hour} { + lappend trouble [list mzone $mzone ms1 is $ms1] + } + # S means 'seconds' and therefore isn't parsed as a time zone. + # Yet another ambiguity in the free-form scanner! + if {$mzone ne "S"} { + if {$ms2 != $base + 3600 * $hour} { + lappend trouble [list mzone $mzone ms2 is $ms2] + } + } + incr hour + } + join $trouble \n +} {} + + + + + # cleanup namespace delete ::testClock |