Files
fail/debuggers/openocd/jimtcl/tests/filejoin.test
Lars Rademacher 83d72a091e debuggers: import openocd-0.7.0
Initial check-in of openocd-0.7.0 as it can be downloaded from
http://sourceforge.net/projects/openocd/files/openocd/0.7.0/

Any modifications will follow.

Change-Id: I6949beaefd589e046395ea0cb80f4e1ab1654d55
2013-12-02 14:53:22 +01:00

85 lines
1.6 KiB
Plaintext

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