blob: 4e32df48caf095fc208731ec4ee93cfc28fc5a15 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
source [file dirname [info script]]/testing.tcl
needs cmd clock
if {[catch {clock scan 2000 -format %Y}]} {
testConstraint clockscan 0
} else {
testConstraint clockscan 1
}
test clock-1.1 {clock usage} -body {
clock
} -returnCodes error -match glob -result {wrong # args: should be "clock command ..."*}
test clock-1.2 {clock usage} -body {
clock blah
} -returnCodes error -match glob -result {clock, unknown command "blah": should be clicks, format, microseconds, milliseconds, *seconds}
# clock format
test clock-3.1 {clock format tests} {
set clockval 657687766
clock format $clockval -format {%a %b %d %I:%M:%S %p %Y} -gmt true
} {Sun Nov 04 03:02:46 AM 1990}
test clock-3.5 {clock format tests} -body {
clock format
} -returnCodes error -result {wrong # args: should be "clock format seconds ?-format string? ?-gmt boolean?"}
test clock-3.6 {clock format tests} -body {
clock format foo
} -returnCodes error -result {expected integer but got "foo"}
test clock-3.8 {clock format tests} -body {
clock format a b c d e g
} -returnCodes error -result {wrong # args: should be "clock format seconds ?-format string? ?-gmt boolean?"}
test clock-3.9 {clock format tests} {
set clockval 0
clock format $clockval -format "%a %b %d %I:%M:%S %p %Y" -gmt true
} "Thu Jan 01 12:00:00 AM 1970"
test clock-3.10 {clock format tests} -body {
clock format 123 -bad arg
} -returnCodes error -result {bad option "-bad": must be -format, or -gmt}
test clock-3.11 {clock format tests} {
clock format 123 -format "x"
} x
test clock-4.1 {clock scan tests} clockscan {
clock scan {Sun Nov 04 03:02:46 AM 1990} -format {%a %b %d %I:%M:%S %p %Y} -gmt true
} 657687766
testreport
|