Trim bootstrap jimsh
[jimtcl.git] / tests / filejoin.test
blob7245938ea13c4a0c366fc493015edce418e457f7
1 source [file dirname [info script]]/testing.tcl
3 needs cmd file
5 test join-1.1 "One name" {
6         file join abc
7 } {abc}
9 test join-1.2 "One name with trailing slash" {
10         file join abc/
11 } {abc}
13 test join-1.3 "One name with leading slash" {
14         file join /abc
15 } {/abc}
17 test join-1.4 "One name with leading and trailing slash" {
18         file join /abc/
19 } {/abc}
21 test join-1.5 "Two names" {
22         file join abc def
23 } {abc/def}
25 test join-1.6 "Two names with dir trailing slash" {
26         file join abc/ def
27 } {abc/def}
29 test join-1.7 "Two names with dir leading slash" {
30         file join /abc def
31 } {/abc/def}
33 test join-1.8 "Two names with dir leading and trailing slash" {
34         file join /abc/ def
35 } {/abc/def}
37 test join-1.9 "Two names with file trailing slash" {
38         file join abc def/
39 } {abc/def}
41 test join-1.10 "Two names with file leading slash" {
42         file join abc /def
43 } {/def}
45 test join-1.11 "Two names with file leading and trailing slash" {
46         file join abc /def/
47 } {/def}
49 test join-1.12 "Two names with double slashes" {
50         file join abc/ /def
51 } {/def}
53 test join-1.13 "Join to root" {
54         file join / abc
55 } {/abc}
57 test join-1.14 "Join to root" {
58         set dir [file join / .]
59         # Either / or /. is OK here
60         expr {$dir in {/ /.}}
61 } 1
63 test join-1.15 "Join to root" {
64         file join / /
65 } {/}
67 test join-1.16 "Join to root" {
68         file join /abc /
69 } {/}
71 test join-2.1 "Dir is empty string" {
72         file join "" def
73 } {def}
75 test join-2.2 "File is empty string" {
76         file join abc ""
77 } {abc}
79 test join-2.3 "Path too long" jim {
80         set components [string repeat {abcdefghi } 500]
81         list [catch [concat file join $components] msg] $msg
82 } {1 {Path too long}}
84 testreport