1 source [file dirname [info script]]/testing.tcl
5 if {[catch {clock scan 2000 -format %Y}]} {
6 testConstraint clockscan 0
8 testConstraint clockscan 1
11 test clock-1.1 {clock usage} -body {
13 } -returnCodes error -match glob -result {wrong # args: should be "clock command ..."*}
15 test clock-1.2 {clock usage} -body {
17 } -returnCodes error -match glob -result {clock, unknown command "blah": should be clicks, format, microseconds, milliseconds, *seconds}
20 test clock-3.1 {clock format tests} {
21 set clockval 657687766
22 clock format $clockval -format {%a %b %d %I:%M:%S %p %Y} -gmt true
23 } {Sun Nov 04 03:02:46 AM 1990}
25 test clock-3.5 {clock format tests} -body {
27 } -returnCodes error -result {wrong # args: should be "clock format seconds ?-format string? ?-gmt boolean?"}
29 test clock-3.6 {clock format tests} -body {
31 } -returnCodes error -result {expected integer but got "foo"}
33 test clock-3.8 {clock format tests} -body {
34 clock format a b c d e g
35 } -returnCodes error -result {wrong # args: should be "clock format seconds ?-format string? ?-gmt boolean?"}
37 test clock-3.9 {clock format tests} {
39 clock format $clockval -format "%a %b %d %I:%M:%S %p %Y" -gmt true
40 } "Thu Jan 01 12:00:00 AM 1970"
42 test clock-3.10 {clock format tests} -body {
43 clock format 123 -bad arg
44 } -returnCodes error -result {bad option "-bad": must be -format, or -gmt}
46 test clock-3.11 {clock format tests} {
47 clock format 123 -format "x"
50 test clock-4.1 {clock scan tests} clockscan {
51 clock scan {Sun Nov 04 03:02:46 AM 1990} -format {%a %b %d %I:%M:%S %p %Y} -gmt true