diff options
Diffstat (limited to 'tests/fileSystem.test')
-rw-r--r-- | tests/fileSystem.test | 71 |
1 files changed, 57 insertions, 14 deletions
diff --git a/tests/fileSystem.test b/tests/fileSystem.test index eb3f6cb..5e5e9c8 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -32,60 +32,103 @@ makeDirectory dir.file makeFile "test file in directory" [file join dir.file inside.file] if {[catch { - testfilelink link.file gorp.file - testfilelink \ + file link link.file gorp.file + file link \ [file join dir.file linkinside.file] \ [file join dir.file inside.file] - testfilelink dir.link dir.file + file link dir.link dir.file }]} { - tcltest::testConstraint links 0 + tcltest::testConstraint hasLinks 0 } else { - tcltest::testConstraint links 1 + tcltest::testConstraint hasLinks 1 } -test filesystem-1.0 {link normalisation} {links} { +test filesystem-1.0 {link normalisation} {hasLinks} { string equal [file normalize gorp.file] [file normalize link.file] } {0} -test filesystem-1.1 {link normalisation} {links} { +test filesystem-1.1 {link normalisation} {hasLinks} { string equal [file normalize dir.file] [file normalize dir.link] } {0} -test filesystem-1.2 {link normalisation} {links macOrUnix} { +test filesystem-1.2 {link normalisation} {hasLinks macOrUnix} { string equal [file normalize [file join gorp.file foo]] \ [file normalize [file join link.file foo]] } {1} -test filesystem-1.3 {link normalisation} {links} { +test filesystem-1.3 {link normalisation} {hasLinks} { string equal [file normalize [file join dir.file foo]] \ [file normalize [file join dir.link foo]] } {1} -test filesystem-1.4 {link normalisation} {links} { +test filesystem-1.4 {link normalisation} {hasLinks} { string equal [file normalize [file join dir.file inside.file]] \ [file normalize [file join dir.link inside.file]] } {1} -test filesystem-1.5 {link normalisation} {links} { +test filesystem-1.5 {link normalisation} {hasLinks} { string equal [file normalize [file join dir.file linkinside.file]] \ [file normalize [file join dir.file linkinside.file]] } {1} -test filesystem-1.6 {link normalisation} {links} { +test filesystem-1.6 {link normalisation} {hasLinks} { string equal [file normalize [file join dir.file linkinside.file]] \ [file normalize [file join dir.link inside.file]] } {0} -test filesystem-1.7 {link normalisation} {links macOrUnix} { +test filesystem-1.7 {link normalisation} {hasLinks macOrUnix} { string equal [file normalize [file join dir.link linkinside.file foo]] \ [file normalize [file join dir.file inside.file foo]] } {1} -test filesystem-1.8 {link normalisation} {links} { +test filesystem-1.8 {link normalisation} {hasLinks} { string equal [file normalize [file join dir.file linkinside.filefoo]] \ [file normalize [file join dir.link inside.filefoo]] } {0} +test filesystem-1.9 {link normalisation} {hasLinks} { + file delete -force dir.link + file link dir.link [file nativename dir.file] + string equal [file normalize [file join dir.file linkinside.file foo]] \ + [file normalize [file join dir.link inside.file foo]] +} {0} + +test filesystem-1.10 {link normalisation: double link} {hasLinks} { + file link dir2.link dir.link + string equal [file normalize [file join dir.file linkinside.file foo]] \ + [file normalize [file join dir2.link inside.file foo]] +} {0} + +makeDirectory dir2.file + +test filesystem-1.11 {link normalisation: double link, back in tree} {hasLinks} { + file link [file join dir2.file dir2.link] dir2.link + string equal [file normalize [file join dir.file linkinside.file foo]] \ + [file normalize [file join dir2.file dir2.link inside.file foo]] +} {0} + +test filesystem-1.12 {file new native path} {} { + for {set i 0} {$i < 10} {incr i} { + foreach f [lsort [glob -nocomplain -type l *]] { + catch {file readlink $f} + } + } + # If we reach here we've succeeded. We used to crash above. + expr 1 +} {1} + +test filesystem-1.13 {file normalisation} {winOnly} { + # This used to be broken + file normalize C:/thislongnamedoesntexist +} {C:/thislongnamedoesntexist} + +test filesystem-1.14 {file normalisation} {winOnly} { + # This used to be broken + file normalize c:/ +} {C:/} + +file delete -force dir2.file +file delete -force dir2.link file delete -force link.file dir.link removeFile [file join dir.file inside.file] removeDirectory dir.file |