summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsebres <sebres@users.sourceforge.net>2020-05-13 11:13:18 (GMT)
committersebres <sebres@users.sourceforge.net>2020-05-13 11:13:18 (GMT)
commit137310bc48c268ffa2c880ec847258e394e1475c (patch)
tree704913458fb9aa3b5862d3a6d0701c7e41e25f1f
parent1997c5874fe102757dcfed67aa1e4591add309fb (diff)
parentbe515de988c81feea02022fb95bc65fd032ea526 (diff)
downloadtcl-137310bc48c268ffa2c880ec847258e394e1475c.zip
tcl-137310bc48c268ffa2c880ec847258e394e1475c.tar.gz
tcl-137310bc48c268ffa2c880ec847258e394e1475c.tar.bz2
merge 8.5
-rw-r--r--tests/clock.test18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/clock.test b/tests/clock.test
index 6323a63..9c59b03 100644
--- a/tests/clock.test
+++ b/tests/clock.test
@@ -35029,6 +35029,24 @@ test clock-30.8 {clock add months, negative} {
set x4 [clock format $f4 -format %Y-%m-%d -timezone :UTC]
list $x1 $x2 $x3 $x4
} {2000-02-29 2000-01-31 1999-12-31 1999-11-30}
+test clock-30.8a {clock add months, negative, over threshold of a year} {
+ set t [clock scan 2019-01-31 -format %Y-%m-%d -gmt 1]
+ list [clock format [clock add $t -1 month -gmt 1] -format %Y-%m-%d -gmt 1] \
+ [clock format [clock add $t -2 month -gmt 1] -format %Y-%m-%d -gmt 1] \
+ [clock format [clock add $t -3 month -gmt 1] -format %Y-%m-%d -gmt 1] \
+ [clock format [clock add $t -4 month -gmt 1] -format %Y-%m-%d -gmt 1]
+} {2018-12-31 2018-11-30 2018-10-31 2018-09-30}
+test clock-30.8b {clock add months, negative, over threshold of a year} {
+ set t [clock scan 2000-01-28 -format %Y-%m-%d -gmt 1]
+ for {set i 1} {$i < 24} {incr i 1} {
+ set f1 [clock add $t -$i month -gmt 1]
+ set f2 [clock add $f1 $i month -gmt 1]
+ if {$f2 != $t} {
+ error "\[clock add $t -$i month -gmt 1\] does not consider\
+ \[clock add $f1 $i month -gmt 1\] != $t"
+ }
+ }
+} {}
test clock-30.9 {clock add days} {
set t [clock scan {2000-01-01 12:34:56} -format {%Y-%m-%d %H:%M:%S} \
-timezone :UTC]