Skip to content

Commit

Permalink
merge 8.7
Browse files Browse the repository at this point in the history
  • Loading branch information
sebres committed Nov 15, 2024
2 parents 5361f86 + 09256fa commit 67cd3a9
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions tests/clock.test
Original file line number Diff line number Diff line change
Expand Up @@ -38438,30 +38438,51 @@ test clock-67.5 {Change scan %x output on global locale change [Bug 4a0c163d24]}
msgcat::mclocale $current
} -result {1}

test clock-68.1 {Leap second [f2b5f89c0d], valid} -body {
clock scan "2012-06-30 23:59:60" -gmt 1 -valid 0
} -result 1341100800
test clock-68.2 {Leap minute [f2b5f89c0d], valid} -body {
clock scan "2012-06-30 23:60:00" -gmt 1 -valid 0
} -result 1341100800
test clock-68.3 {Leap hour [f2b5f89c0d], valid} -body {
clock scan "2012-06-30 24:00:00" -gmt 1 -valid 0
} -result 1341100800
test clock-68.4 {Leap second [f2b5f89c0d], wrong day} -body {
clock scan "2012-06-29 23:59:60" -gmt 1 -valid 1
} -errorCode {CLOCK invInpStr seconds} -result {unable to convert input string: invalid time}
test clock-68.5 {Leap second [f2b5f89c0d], wrong month} -body {
clock scan "2012-05-30 23:59:60" -gmt 1 -valid 1
} -errorCode {CLOCK invInpStr seconds} -result {unable to convert input string: invalid time}
test clock-68.6 {Leap second [f2b5f89c0d], minute} -body {
clock scan "2012-05-30 23:60:60" -gmt 1 -valid 1
} -errorCode {CLOCK invInpStr minutes} -result {unable to convert input string: invalid time (minutes)}
test clock-68.7 {Leap second [f2b5f89c0d], hour + second} -body {
clock scan "2012-05-30 24:00:60" -gmt 1 -valid 1
} -errorCode {CLOCK invInpStr hour} -result {unable to convert input string: invalid time (hour)}
test clock-68.8 {Leap second [f2b5f89c0d], hour + minute} -body {
clock scan "2012-05-30 24:60:00" -gmt 1 -valid 1
} -errorCode {CLOCK invInpStr hour} -result {unable to convert input string: invalid time (hour)}
test clock-68.1 {Leap second, minute, hour [f2b5f89c0d], regression test (no validity check)} -constraints valid_off -body {
set res {}
foreach {d i} {
"2012-06-30 23:59:60" 1341100800
"2012-06-30 23:60:00" 1341100800
"2012-06-30 24:00:00" 1341100800
"2012-06-29 23:59:60" 1341014400
"2012-05-30 23:59:60" 1338422400
"2012-05-30 23:60:60" 1338422460
"2012-05-30 24:00:60" 1338422460
"2012-05-30 24:60:00" 1338426000
} {
# check with free scan:
if {[set t [clock scan $d -gmt 1]] != $i} {
lappend res "free-scan \"$d\" == $t, expected $i"
}
# check with formatted scan:
if {[set t [clock scan $d -gmt 1 -format "%Y-%m-%d %H:%M:%S"]] != $i} {
lappend res "fmt-scan \"$d\" == $t, expected $i"
}
}
set res; # must be empty
} -result {}
test clock-68.2 {Leap second, minute, hour [f2b5f89c0d], regression test (validity check)} -constraints !valid_off -body {
# regardless solution for [f2b5f89c0d], this conversions must fail on -valid 1 (constraints !valid_off),
# because of wrong day and month for the leap second:
set res {}
foreach {d i} {
"2012-06-29 23:59:60" "invalid time"
"2012-05-30 23:59:60" "invalid time"
"2012-05-30 23:60:60" "invalid time"
"2012-05-30 24:00:60" "invalid time"
"2012-05-30 24:60:00" "invalid time"
} {
# check with free scan:
if {![catch { clock scan $d -gmt 1 } t] || ![string match *$i* $t]} {
lappend res "free-scan \"$d\" == \"$t\", expected \"$i\""
}
# check with formatted scan:
if {![catch { clock scan $d -gmt 1 -format "%Y-%m-%d %H:%M:%S" } t] || ![string match *$i* $t]} {
lappend res "fmt-scan \"$d\" == \"$t\", expected \"$i\""
}
}
set res; # must be empty
} -result {}

# cleanup

Expand All @@ -38474,6 +38495,11 @@ if {$valid_mode && [info exists ::tcltest::skippedBecause(valid_off)]} {
incr ::tcltest::numTests(Skipped) -$::tcltest::skippedBecause(valid_off)
unset ::tcltest::skippedBecause(valid_off)
}
if {!$valid_mode && [info exists ::tcltest::skippedBecause(!valid_off)]} {
incr ::tcltest::numTests(Total) -$::tcltest::skippedBecause(!valid_off)
incr ::tcltest::numTests(Skipped) -$::tcltest::skippedBecause(!valid_off)
unset ::tcltest::skippedBecause(!valid_off)
}
::tcltest::cleanupTests
namespace delete ::testClock
unset valid_mode
Expand Down

0 comments on commit 67cd3a9

Please sign in to comment.