diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/cmdAH.test | 13 | ||||
-rw-r--r-- | tests/fCmd.test | 7 | ||||
-rw-r--r-- | tests/fileSystem.test | 8 | ||||
-rw-r--r-- | tests/ioUtil.test | 6 | ||||
-rw-r--r-- | tests/reg.test | 90 | ||||
-rw-r--r-- | tests/unixFCmd.test | 20 | ||||
-rw-r--r-- | tests/winFile.test | 6 |
7 files changed, 125 insertions, 25 deletions
diff --git a/tests/cmdAH.test b/tests/cmdAH.test index fe16def..0a0228b 100644 --- a/tests/cmdAH.test +++ b/tests/cmdAH.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: cmdAH.test,v 1.30 2003/01/09 10:38:32 vincentdarley Exp $ +# RCS: @(#) $Id: cmdAH.test,v 1.31 2003/04/11 15:59:59 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2.1 @@ -86,6 +86,9 @@ test cmdAH-2.5 {Tcl_CdObjCmd} { test cmdAH-2.6 {Tcl_CdObjCmd} { list [catch {cd _foobar} msg] $msg } {1 {couldn't change working directory to "_foobar": no such file or directory}} +test cmdAH-2.6.1 {Tcl_CdObjCmd} { + list [catch {cd ""} msg] $msg +} {1 {couldn't change working directory to "": no such file or directory}} test cmdAH-2.7 {Tcl_ConcatObjCmd} { concat @@ -396,12 +399,12 @@ test cmdAH-8.42 {Tcl_FileObjCmd: dirname} { test cmdAH-8.43 {Tcl_FileObjCmd: dirname} { global env set temp $env(HOME) - set env(HOME) "/home/test" + set env(HOME) "/homewontexist/test" testsetplatform unix set result [list [catch {file dirname ~} msg] $msg] set env(HOME) $temp set result -} {0 /home} +} {0 /homewontexist} test cmdAH-8.44 {Tcl_FileObjCmd: dirname} { global env set temp $env(HOME) @@ -414,12 +417,12 @@ test cmdAH-8.44 {Tcl_FileObjCmd: dirname} { test cmdAH-8.45 {Tcl_FileObjCmd: dirname} { global env set temp $env(HOME) - set env(HOME) "/home/test" + set env(HOME) "/homewontexist/test" testsetplatform windows set result [list [catch {file dirname ~} msg] $msg] set env(HOME) $temp set result -} {0 /home} +} {0 /homewontexist} test cmdAH-8.46 {Tcl_FileObjCmd: dirname} { global env set temp $env(HOME) diff --git a/tests/fCmd.test b/tests/fCmd.test index e3bec24..8c5d944 100644 --- a/tests/fCmd.test +++ b/tests/fCmd.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: fCmd.test,v 1.26 2003/02/12 19:18:13 vincentdarley Exp $ +# RCS: @(#) $Id: fCmd.test,v 1.27 2003/04/11 15:59:59 vincentdarley Exp $ # if {[lsearch [namespace children] ::tcltest] == -1} { @@ -673,6 +673,11 @@ test fCmd-8.2 {FileBasename: basename of ~user: argc == 1 && *path == ~} \ {unixOnly notRoot} { file tail ~$user } "$user" +test fCmd-8.3 {file copy and path translation: ensure correct error} { + list [catch {file copy ~ [file join this file doesnt exist]} res] $res +} [list 1 \ + "error copying \"~\" to \"[file join this file doesnt exist]\":\ + no such file or directory"] test fCmd-9.1 {file rename: comprehensive: EACCES} {unixOnly notRoot} { cleanup diff --git a/tests/fileSystem.test b/tests/fileSystem.test index f35eae1..08d4a88 100644 --- a/tests/fileSystem.test +++ b/tests/fileSystem.test @@ -43,6 +43,9 @@ if {[catch { tcltest::testConstraint hasLinks 1 } +tcltest::testConstraint testsimplefilesystem \ + [string equal testsimplefilesystem [info commands testsimplefilesystem]] + test filesystem-1.0 {link normalisation} {hasLinks} { string equal [file normalize gorp.file] [file normalize link.file] } {0} @@ -389,7 +392,7 @@ test filesystem-6.33 {empty file name} { while {![catch {testfilesystem 0}]} {} } -test filesystem-7.1 {load from vfs} {win} { +test filesystem-7.1 {load from vfs} {win testsimplefilesystem} { # This may cause a crash on exit set dir [pwd] cd [file dirname [info nameof]] @@ -403,7 +406,8 @@ test filesystem-7.1 {load from vfs} {win} { # The real result of this test is what happens when Tcl exits. } {ok} -test filesystem-7.2 {cross-filesystem copy from vfs maintains mtime} { +test filesystem-7.2 {cross-filesystem copy from vfs maintains mtime} \ + {testsimplefilesystem} { set dir [pwd] cd [tcltest::temporaryDirectory] # We created this file several tests ago. diff --git a/tests/ioUtil.test b/tests/ioUtil.test index 812e3e4..273f47e 100644 --- a/tests/ioUtil.test +++ b/tests/ioUtil.test @@ -8,7 +8,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: ioUtil.test,v 1.13 2002/07/18 09:40:24 vincentdarley Exp $ +# RCS: @(#) $Id: ioUtil.test,v 1.14 2003/04/11 16:00:00 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -113,14 +113,14 @@ test ioUtil-1.8 {TclStatDeleteProc: Verify that all procs have been deleted.} {t eval $unsetScript -test ioUtil-1.1 {TclAccess: Check that none of the test procs are there.} { +test ioUtil-1.9 {TclAccess: Check that none of the test procs are there.} { catch {file exists testAccess1%.fil} err1 catch {file exists testAccess2%.fil} err2 catch {file exists testAccess3%.fil} err3 list $err1 $err2 $err3 } {0 0 0} -test ioUtil-1.2 {TclAccessInsertProc: Insert the 3 test TclAccess_ procedures.} {testaccessproc} { +test ioUtil-1.10 {TclAccessInsertProc: Insert the 3 test TclAccess_ procedures.} {testaccessproc} { catch {testaccessproc insert TclpAccess} err1 testaccessproc insert TestAccessProc1 testaccessproc insert TestAccessProc2 diff --git a/tests/reg.test b/tests/reg.test index 86f0098..1d1c8aa 100644 --- a/tests/reg.test +++ b/tests/reg.test @@ -9,7 +9,7 @@ # # Copyright (c) 1998, 1999 Henry Spencer. All rights reserved. # -# RCS: @(#) $Id: reg.test,v 1.16 2002/07/29 12:28:35 dkf Exp $ +# RCS: @(#) $Id: reg.test,v 1.17 2003/04/11 16:00:00 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest 2 @@ -995,6 +995,94 @@ test reg-31.1 {[[:xdigit:]] behaves correctly when followed by [[:space:]]} { # Code used to produce {1 2:::DebugWin32 2 :::DebugWin32} !!! } {1 2 2 {}} +test reg-32.1 {canmatch functionality -- at end} { + set pat {blah} + set line "asd asd" + # can match at the final d, if '%' follows + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 7} + +test reg-32.2 {canmatch functionality -- at end} { + set pat {s%$} + set line "asd asd" + # can only match after the end of the string + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 7} + +test reg-32.3 {canmatch functionality -- not last char} { + set pat {[^d]%$} + set line "asd asd" + # can only match after the end of the string + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 7} + +test reg-32.3.1 {canmatch functionality -- no match} { + set pat {\Zx} + set line "asd asd" + # can match the last char, if followed by x + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 -1} + +test reg-32.4 {canmatch functionality -- last char} {knownBug} { + set pat {.x} + set line "asd asd" + # can match the last char, if followed by x + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + +test reg-32.4.1 {canmatch functionality -- last char} {knownBug} { + set pat {.x$} + set line "asd asd" + # can match the last char, if followed by x + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + +test reg-32.5 {canmatch functionality -- last char} {knownBug} { + set pat {.[^d]x$} + set line "asd asd" + # can match the last char, if followed by not-d and x. + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + +test reg-32.6 {canmatch functionality -- last char} {knownBug} { + set pat {[^a]%[^\r\n]*$} + set line "asd asd" + # can match at the final d, if '%' follows + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + +test reg-32.7 {canmatch functionality -- last char} {knownBug} { + set pat {[^a]%$} + set line "asd asd" + # can match at the final d, if '%' follows + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + +test reg-32.8 {canmatch functionality -- last char} {knownBug} { + set pat {[^x]%$} + set line "asd asd" + # can match at the final d, if '%' follows + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + +test reg-32.9 {canmatch functionality -- more complex case} {knownBug} { + set pat {((\B\B|\Bh+line)[ \t]*|[^\B]%[^\r\n]*)$} + set line "asd asd" + # can match at the final d, if '%' follows + set res [testregexp -xflags -- c $pat $line resvar] + lappend res $resvar +} {0 6} + # cleanup ::tcltest::cleanupTests return diff --git a/tests/unixFCmd.test b/tests/unixFCmd.test index ca707a4..574c5cc 100644 --- a/tests/unixFCmd.test +++ b/tests/unixFCmd.test @@ -9,7 +9,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: unixFCmd.test,v 1.17 2003/01/25 00:16:39 hobbs Exp $ +# RCS: @(#) $Id: unixFCmd.test,v 1.18 2003/04/11 16:00:02 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -285,7 +285,7 @@ test unixFCmd-17.3 {SetPermissionsAttribute} {unixOnly notRoot} { list [catch {file attributes foo.test -permissions foo} msg] $msg \ [file delete -force -- foo.test] } {1 {unknown permission string format "foo"} {}} -test unixFCmd-17.3 {SetPermissionsAttribute} {unixOnly notRoot} { +test unixFCmd-17.4 {SetPermissionsAttribute} {unixOnly notRoot} { catch {file delete -force -- foo.test} close [open foo.test w] list [catch {file attributes foo.test -permissions ---rwx} msg] $msg \ @@ -300,14 +300,14 @@ proc permcheck {testnum permstr expected} { file attributes foo.test -permissions } $expected } -permcheck unixFCmd-17.4 rwxrwxrwx 00777 -permcheck unixFCmd-17.5 r--r---w- 00442 -permcheck unixFCmd-17.6 0 00000 -permcheck unixFCmd-17.7 u+rwx,g+r 00740 -permcheck unixFCmd-17.8 u-w 00540 -permcheck unixFCmd-17.9 o+rwx 00547 -permcheck unixFCmd-17.10 --x--x--x 00111 -permcheck unixFCmd-17.11 a+rwx 00777 +permcheck unixFCmd-17.5 rwxrwxrwx 00777 +permcheck unixFCmd-17.6 r--r---w- 00442 +permcheck unixFCmd-17.7 0 00000 +permcheck unixFCmd-17.8 u+rwx,g+r 00740 +permcheck unixFCmd-17.9 u-w 00540 +permcheck unixFCmd-17.10 o+rwx 00547 +permcheck unixFCmd-17.11 --x--x--x 00111 +permcheck unixFCmd-17.12 a+rwx 00777 file delete -force -- foo.test test unixFCmd-18.1 {Unix pwd} {nonPortable unixOnly notRoot} { diff --git a/tests/winFile.test b/tests/winFile.test index 4b04096..3f4c294 100644 --- a/tests/winFile.test +++ b/tests/winFile.test @@ -10,7 +10,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: winFile.test,v 1.9 2002/07/18 16:36:56 vincentdarley Exp $ +# RCS: @(#) $Id: winFile.test,v 1.10 2003/04/11 16:00:05 vincentdarley Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -25,7 +25,7 @@ test winFile-1.2 {TclpGetUserHome} {pcOnly nt nonPortable} { catch {glob ~administrator} } {0} -test winFile-1.2 {TclpGetUserHome} {pcOnly 95} { +test winFile-1.3 {TclpGetUserHome} {pcOnly 95} { # Find some user in system.ini and then see if they have a home. set f [open $::env(windir)/system.ini] @@ -44,7 +44,7 @@ test winFile-1.2 {TclpGetUserHome} {pcOnly 95} { close $f set x } {0} -test winFile-1.3 {TclpGetUserHome} {pcOnly nt nonPortable} { +test winFile-1.4 {TclpGetUserHome} {pcOnly nt nonPortable} { catch {glob ~stanton@workgroup} } {0} |