1 source [file dirname [info script]]/testing.tcl
5 test join-1.1 "One name" {
9 test join-1.2 "One name with trailing slash" {
13 test join-1.3 "One name with leading slash" {
17 test join-1.4 "One name with leading and trailing slash" {
21 test join-1.5 "Two names" {
25 test join-1.6 "Two names with dir trailing slash" {
29 test join-1.7 "Two names with dir leading slash" {
33 test join-1.8 "Two names with dir leading and trailing slash" {
37 test join-1.9 "Two names with file trailing slash" {
41 test join-1.10 "Two names with file leading slash" {
45 test join-1.11 "Two names with file leading and trailing slash" {
49 test join-1.12 "Two names with double slashes" {
53 test join-1.13 "Join to root" {
57 test join-1.14 "Join to root" {
58 set dir [file join / .]
59 # Either / or /. is OK here
63 test join-1.15 "Join to root" {
67 test join-1.16 "Join to root" {
71 test join-1.17 "With trailing slash" {
72 file join /abc/def/ ghi/jkl
75 test join-2.1 "Dir is empty string" {
79 test join-2.2 "File is empty string" {
83 test join-2.3 "Path too long" jim {
84 set components [string repeat {abcdefghi } 500]
85 list [catch [concat file join $components] msg] $msg
88 test tail-1.1 "One component" {
92 test tail-1.2 "Two components" {
96 test tail-1.3 "Absolute one component" {
100 test tail-1.4 "Trailing slash" {
104 test dirname-1.1 "One component" {
108 test dirname-1.2 "Two components" {
112 test dirname-1.3 "Absolute one component" {
116 test dirname-1.4 "Trailing slash" {
120 # These tests are courtesy of picol
122 test file.12.1 "picol test" {file dirname /foo/bar/grill.txt} /foo/bar
123 test file.12.2 "picol test" {file dirname /foo/bar/baz/} /foo/bar
124 test file.12.3 "picol test" {file dirname /foo/bar/baz///} /foo/bar
125 test file.12.4 "picol test" {file dirname /foo/bar/baz///qux} /foo/bar/baz
126 test file.12.5 "picol test" {file dirname foo/bar/grill.txt} foo/bar
127 test file.12.6 "picol test" {file dirname foo/bar/baz/} foo/bar
128 test file.12.7 "picol test" {file dirname {}} .
129 test file.12.8 "picol test" {file dirname /} /
130 test file.12.9 "picol test" {file dirname ///} /
132 test file.13.1 "picol test" {file tail /foo/bar/grill.txt} grill.txt
133 test file.13.2 "picol test" {file tail /foo/bar/baz/} baz
134 test file.13.3 "picol test" {file tail /foo/bar/baz///} baz
135 test file.13.4 "picol test" {file dirname /foo/bar/baz///qux} /foo/bar/baz
136 test file.13.5 "picol test" {file tail foo/bar/grill.txt} grill.txt
137 test file.13.6 "picol test" {file tail foo/bar/baz/} baz
138 test file.13.7 "picol test" {file tail {}} {}
139 test file.13.8 "picol test" {file tail /} {}
140 test file.13.9 "picol test" {file tail ///} {}
142 test file.14 "picol test" {file join foo} foo
143 test file.15 "picol test" {file join foo bar} foo/bar
144 test file.16 "picol test" {file join foo /bar} /bar
146 if {$tcl_platform(platform) eq {windows}} {
147 test file.17 "picol test" {file join foo C:/bar grill} C:/bar/grill
150 test file.18 "picol test" {file split {/foo/space station/bar}} {/ foo {space station} bar}
151 test file.19 "picol test" {file split {/foo/space station/bar/}} {/ foo {space station} bar}
152 test file.20 "picol test" {file split {foo/space station/bar}} {foo {space station} bar}
153 test file.21 "picol test" {file split foo///bar} {foo bar}
154 test file.22 "picol test" {file split foo} foo