diff options
author | sebres <sebres@users.sourceforge.net> | 2017-01-10 23:02:02 (GMT) |
---|---|---|
committer | sebres <sebres@users.sourceforge.net> | 2017-01-10 23:02:02 (GMT) |
commit | 77a54daa546c50756c2734f86b9e230f02bcc676 (patch) | |
tree | 797ec4ebde45a5be9332c0046013aadd9652e431 /tests/clock.test | |
parent | a46b1f79d3095b4e867148fee2cb94dfe84fab44 (diff) | |
download | tcl-77a54daa546c50756c2734f86b9e230f02bcc676.zip tcl-77a54daa546c50756c2734f86b9e230f02bcc676.tar.gz tcl-77a54daa546c50756c2734f86b9e230f02bcc676.tar.bz2 |
"clock add" rewritten in C, using common functionality of "clock scan" (and freescan)...
test-performance.tcl: test cases extended to cover "clock add"
Diffstat (limited to 'tests/clock.test')
-rw-r--r-- | tests/clock.test | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/tests/clock.test b/tests/clock.test index d9c491a..b540024 100644 --- a/tests/clock.test +++ b/tests/clock.test @@ -254,7 +254,7 @@ proc ::testClock::registry { cmd path key } { test clock-1.0 "clock format - wrong # args" { list [catch {clock format} msg] $msg $::errorCode -} {1 {wrong # args: should be "clock format clockval ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} +} {1 {wrong # args: should be "clock format clockval|-now ?-format string? ?-gmt boolean? ?-locale LOCALE? ?-timezone ZONE?"} {CLOCK wrongNumArgs}} test clock-1.1 "clock format - bad time" { list [catch {clock format foo} msg] $msg @@ -270,10 +270,11 @@ test clock-1.3 "clock format - empty val" { test clock-1.4 "clock format - bad flag" {*}{ -body { - list [catch {clock format 0 -oops badflag} msg] $msg $::errorCode + # range error message for possible extensions: + list [catch {clock format 0 -oops badflag} msg] [string range $msg 0 60] $::errorCode } -match glob - -result {1 {bad option "-oops": must be -format, -gmt, -locale, or -timezone} {CLOCK badOption -oops}} + -result {1 {bad option "-oops": must be -format, -gmt, -locale, -timezone} {CLOCK badOption -oops}} } test clock-1.5 "clock format - bad timezone" { @@ -288,6 +289,16 @@ test clock-1.7 "clock format - option abbreviations" { clock format 0 -g true -f "%Y-%m-%d" } 1970-01-01 +test clock-1.8 "clock format -now" { + # give one second more for test (if on boundary of the current second): + set n [clock format [clock seconds] -g 1 -f "%s"] + expr {[clock format -now -g 1 -f "%s"] in [list $n [incr n]]} +} 1 + +test clock-1.9 "clock arguments: option doubly present" { + list [catch {clock format 0 -gmt 1 -gmt 0} result] $result +} {1 {bad option "-gmt": doubly present}} + # BEGIN testcases2 # Test formatting of Gregorian year, month, day, all formats |