Tcl Library Source Code

Check-in [2f98801dfb]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Module "clock", first true test cases. Fixed copyright date of test suites
Timelines: family | ancestors | descendants | both | new-module-clock
Files: files | file ages | folders
SHA1: 2f98801dfb653e265a9c2f83e30c6ede72346dca
User & Date: andreask 2013-02-01 19:00:04
Original Comment: clock module, first true test cases. Fised copyright date of test suites
Context
2013-02-02
03:25
Added test for various ISO formats. check-in: d6cc1fe035 user: gerald tags: new-module-clock
2013-02-01
19:04
Merged new module "clock" and its packages. Updated README, installer. check-in: cd800dd45a user: andreask tags: tcllib-1-15-rc
19:00
Module "clock", first true test cases. Fixed copyright date of test suites check-in: 2f98801dfb user: andreask tags: new-module-clock
07:52
Fixed various oopses, and added extremely basic test suites. check-in: e10fcf124a user: aku tags: new-module-clock
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/clock/iso8601.test.

1
2
3
4
5
6
7
8
9
10
..
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
# -------------------------------------------------------------------------
# iso8601.test -*- tcl -*-
# (C) 2012 Andreas Kupries. BSD licensed.
# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
................................................................................
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_date string ..."}

test clock-iso8601-1.0.1 {parse_date wrong\#args} -constraints {tcl8.6plus} -body {
    clock::iso8601 parse_date
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_date string ?arg ...?"}

test clock-iso8601-1.1 {parse_date, bad option} -body {
       clock::iso8601 parse_date A -foo x
} -returnCodes error -result {not an iso8601 date string}






# -------------------------------------------------------------------------










# -------------------------------------------------------------------------

test clock-iso8601-5.0.0 {parse_time wrong\#args} -constraints {tcl8.5plus tcl8.5minus} -body {
    clock::iso8601 parse_time
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_time string ..."}

................................................................................
test clock-iso8601-5.0.1 {parse_time wrong\#args} -constraints {tcl8.6plus} -body {
    clock::iso8601 parse_time
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_time string ?arg ...?"}

test clock-iso8601-6.1 {parse_time, bad option} -body {
       clock::iso8601 parse_time A -foo x
} -returnCodes error -result {not an iso8601 time string}














# -------------------------------------------------------------------------
testsuiteCleanup
return

# Local Variables:
#  mode: tcl
#  indent-tabs-mode: nil
# End:

|







 







|
|

>
>
>
>
>

>
>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>









1
2
3
4
5
6
7
8
9
10
..
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# -------------------------------------------------------------------------
# iso8601.test -*- tcl -*-
# (C) 2013 Andreas Kupries. BSD licensed.
# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
................................................................................
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_date string ..."}

test clock-iso8601-1.0.1 {parse_date wrong\#args} -constraints {tcl8.6plus} -body {
    clock::iso8601 parse_date
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_date string ?arg ...?"}

test clock-iso8601-1.1 {parse_date, bad option} -body {
    clock::iso8601 parse_date 1994-11-05 -foo x
} -returnCodes error -result {bad switch "-foo", must be -base, -format, -gmt, -locale or -timezone}

# NOTE: While listed as legal, -format is NOT. This is because the
# command simply hands off to clock scan, and we are seeing its error
# message.  Either we do our own argument check first, or we capture
# and rewrite the error.

# -------------------------------------------------------------------------

test clock-iso8601-2.0 {parse_date, bad input} -body {
    clock::iso8601 parse_date A
} -returnCodes error -result {not an iso8601 date string}

test clock-iso8601-2.1 {parse_date} -body {
    clock::iso8601 parse_date 1994-11-05
    # It is unclear if this is influenced by TZ.
} -result 784022400

# -------------------------------------------------------------------------

test clock-iso8601-5.0.0 {parse_time wrong\#args} -constraints {tcl8.5plus tcl8.5minus} -body {
    clock::iso8601 parse_time
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_time string ..."}

................................................................................
test clock-iso8601-5.0.1 {parse_time wrong\#args} -constraints {tcl8.6plus} -body {
    clock::iso8601 parse_time
} -returnCodes error -result {wrong # args: should be "clock::iso8601 parse_time string ?arg ...?"}

test clock-iso8601-6.1 {parse_time, bad option} -body {
       clock::iso8601 parse_time A -foo x
} -returnCodes error -result {not an iso8601 time string}

# -------------------------------------------------------------------------

test clock-iso8601-7.0 {parse_time, bad input} -body {
       clock::iso8601 parse_time A
} -returnCodes error -result {not an iso8601 time string}

test clock-iso8601-7.1 {parse_time} -body {
    # The difference to midnight is constant.
    # The day part is not, and there is TZ.
    expr {[clock::iso8601 parse_time 08:15:30] -
          [clock::iso8601 parse_time 00:00:00]}
} -result 29730

# -------------------------------------------------------------------------
testsuiteCleanup
return

# Local Variables:
#  mode: tcl
#  indent-tabs-mode: nil
# End:

Changes to modules/clock/rfc2822.test.

1
2
3
4
5
6
7
8
9
10
..
23
24
25
26
27
28
29
30
31
32
33


34
35
36
37
38
39
40
41
42
# -------------------------------------------------------------------------
# rfc2822.test -*- tcl -*-
# (C) 2012 Andreas Kupries. BSD licensed.
# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
................................................................................
test clock-rfc2822-1.1 {parse_date wrong\#args} -body {
    clock::rfc2822 parse_date D X
} -returnCodes error -result {wrong # args: should be "clock::rfc2822 parse_date date"}

# -------------------------------------------------------------------------

test clock-rfc2822-2.0 {parse_date, bad input} -body {
       clock::rfc2822 parse_date D
} -returnCodes error -result {expected an RFC2822 date, got "D"}

# -------------------------------------------------------------------------



# -------------------------------------------------------------------------
testsuiteCleanup
return

# Local Variables:
#  mode: tcl
#  indent-tabs-mode: nil
# End:

|







 







|


|
>
>









1
2
3
4
5
6
7
8
9
10
..
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# -------------------------------------------------------------------------
# rfc2822.test -*- tcl -*-
# (C) 2013 Andreas Kupries. BSD licensed.
# -------------------------------------------------------------------------

source [file join \
	[file dirname [file dirname [file join [pwd] [info script]]]] \
	devtools testutilities.tcl]

testsNeedTcl     8.5
................................................................................
test clock-rfc2822-1.1 {parse_date wrong\#args} -body {
    clock::rfc2822 parse_date D X
} -returnCodes error -result {wrong # args: should be "clock::rfc2822 parse_date date"}

# -------------------------------------------------------------------------

test clock-rfc2822-2.0 {parse_date, bad input} -body {
    clock::rfc2822 parse_date D
} -returnCodes error -result {expected an RFC2822 date, got "D"}

test clock-rfc2822-2.1 {parse_date} -body {
    clock::rfc2822 parse_date {Fri, 09 Sep 2005 13:51:39 -0700}
} -result 1126299099

# -------------------------------------------------------------------------
testsuiteCleanup
return

# Local Variables:
#  mode: tcl
#  indent-tabs-mode: nil
# End: