summaryrefslogtreecommitdiffstats
path: root/tests/clock.test
diff options
context:
space:
mode:
authorKevin B Kenny <kennykb@acm.org>2007-04-20 02:23:30 (GMT)
committerKevin B Kenny <kennykb@acm.org>2007-04-20 02:23:30 (GMT)
commit41da80ee66a3a7325bde6e0e8e661a066a932c2b (patch)
treee0126d39453c1ccf075ec3d566184e702106c624 /tests/clock.test
parent7ea39f0edbf37288e5738891d6c8b405bf19dd34 (diff)
downloadtcl-41da80ee66a3a7325bde6e0e8e661a066a932c2b.zip
tcl-41da80ee66a3a7325bde6e0e8e661a066a932c2b.tar.gz
tcl-41da80ee66a3a7325bde6e0e8e661a066a932c2b.tar.bz2
* doc/clock.n: Corrected a silly error (transposed 'uppercase'
and 'lowercase' in clock.n. [Bug 1656002] Clarified that [clock scan] does not recognize a locale's alternative calendar. * library/clock.tcl: Corrected an error in skipping over the %Ey field on input. * library/msgs/ja.msg: * tools/loadICU.tcl: Corrected several localisation faults in the Japanese locale (most notably, incorrect dates for the Emperors' eras). [Bug 1637471]. Many thanks to SourceForge user 'nyademo' for pointing this out and developing a fix. * generic/tclPathObj.c: Corrected a 'const'ness fault that caused bitter complaints from MSVC.
Diffstat (limited to 'tests/clock.test')
-rw-r--r--tests/clock.test77
1 files changed, 76 insertions, 1 deletions
diff --git a/tests/clock.test b/tests/clock.test
index 2006029..b3ffa9c 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.74 2007/04/15 18:59:34 kennykb Exp $
+# RCS: @(#) $Id: clock.test,v 1.75 2007/04/20 02:23:34 kennykb Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -36444,6 +36444,81 @@ test clock-57.1 {clock scan - abbreviated options} {
clock scan 1970-01-01 -f %Y-%m-%d -g true
} 0
+test clock-58.1 {clock l10n - Japanese localisation} {*}{
+ -setup {
+ proc backslashify { string } {
+
+ set retval {}
+ foreach char [split $string {}] {
+ scan $char %c ccode
+ if { $ccode >= 0x0020 && $ccode < 0x007f
+ && $char ne "\{" && $char ne "\}" && $char ne "\["
+ && $char ne "\]" && $char ne "\\" && $char ne "\$" } {
+ append retval $char
+ } else {
+ append retval \\u [format %04x $ccode]
+ }
+ }
+ return $retval
+ }
+ }
+ -body {
+ set trouble {}
+ foreach {date jdate} [list \
+ 1872-12-31 \u897f\u66a61872\u5e7412\u670831\u65e5 \
+ 1873-01-01 \u660e\u6cbb06\u5e7401\u670801\u65e5 \
+ 1912-07-29 \u660e\u6cbb45\u5e7407\u670829\u65e5 \
+ 1912-07-30 \u5927\u6b6301\u5e7407\u670830\u65e5 \
+ 1926-12-24 \u5927\u6b6315\u5e7412\u670824\u65e5 \
+ 1926-12-25 \u662d\u548c01\u5e7412\u670825\u65e5 \
+ 1989-01-07 \u662d\u548c64\u5e7401\u670807\u65e5 \
+ 1989-01-08 \u5e73\u621001\u5e7401\u670808\u65e5 \
+ ] {
+ set status [catch {
+ set secs [clock scan $date \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Y-%m-%d]
+ set jda [clock format $secs \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Ex]
+ } result]
+ if {$status != 0} {
+ append trouble \n $date " gives error " $result
+ } elseif {$jda ne $jdate} {
+ append trouble \n $date " converts to " \
+ [backslashify $jda] " and should be " \
+ [backslashify $jdate]
+ }
+ # There is no code for scanning dates on the locale's
+ # alternative calendar.
+ continue
+ set status [catch {
+ set secs [clock scan $jdate \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Ex]
+ set da [clock format $secs \
+ -timezone +0900 \
+ -locale ja_JP \
+ -format %Y-%m-%d]
+ } result]
+ if {$status != 0} {
+ append trouble \n [backslashify $jdate] " gives error " $result
+ } elseif {$da ne $date} {
+ append trouble \n [backslashify $jdate] " converts to " \
+ $da " and should be " $date
+ }
+ }
+ set trouble
+ }
+ -cleanup {
+ rename backslashify {}
+ }
+ -result {}
+}
+
# cleanup
namespace delete ::testClock