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 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 82 83 84
|
source [file dirname [info script]]/testing.tcl
needs cmd file
test join-1.1 "One name" {
file join abc
} {abc}
test join-1.2 "One name with trailing slash" {
file join abc/
} {abc}
test join-1.3 "One name with leading slash" {
file join /abc
} {/abc}
test join-1.4 "One name with leading and trailing slash" {
file join /abc/
} {/abc}
test join-1.5 "Two names" {
file join abc def
} {abc/def}
test join-1.6 "Two names with dir trailing slash" {
file join abc/ def
} {abc/def}
test join-1.7 "Two names with dir leading slash" {
file join /abc def
} {/abc/def}
test join-1.8 "Two names with dir leading and trailing slash" {
file join /abc/ def
} {/abc/def}
test join-1.9 "Two names with file trailing slash" {
file join abc def/
} {abc/def}
test join-1.10 "Two names with file leading slash" {
file join abc /def
} {/def}
test join-1.11 "Two names with file leading and trailing slash" {
file join abc /def/
} {/def}
test join-1.12 "Two names with double slashes" {
file join abc/ /def
} {/def}
test join-1.13 "Join to root" {
file join / abc
} {/abc}
test join-1.14 "Join to root" {
set dir [file join / .]
# Either / or /. is OK here
expr {$dir in {/ /.}}
} 1
test join-1.15 "Join to root" {
file join / /
} {/}
test join-1.16 "Join to root" {
file join /abc /
} {/}
test join-2.1 "Dir is empty string" {
file join "" def
} {def}
test join-2.2 "File is empty string" {
file join abc ""
} {abc}
test join-2.3 "Path too long" jim {
set components [string repeat {abcdefghi } 500]
list [catch [concat file join $components] msg] $msg
} {1 {Path too long}}
testreport
|