diff options
Diffstat (limited to 'tests/ioCmd.test')
-rw-r--r-- | tests/ioCmd.test | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test index b10738b..63f9895 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: ioCmd.test,v 1.18 2003/10/07 14:58:29 dgp Exp $ +# RCS: @(#) $Id: ioCmd.test,v 1.19 2003/10/07 21:45:39 dgp Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -21,9 +21,6 @@ if {[lsearch [namespace children] ::tcltest] == -1} { testConstraint fcopy [llength [info commands fcopy]] -removeFile test1 -removeFile pipe - test iocmd-1.1 {puts command} { list [catch {puts} msg] $msg } {1 {wrong # args: should be "puts ?-nonewline? ?channelId? string"}} @@ -124,7 +121,7 @@ test iocmd-4.7 {read command} { list [catch {read -nonewline stdout} msg] $msg } {1 {channel "stdout" wasn't opened for reading}} test iocmd-4.8 {read command with incorrect combination of arguments} { - removeFile test1 + file delete $path(test1) set f [open $path(test1) w] puts $f "Two lines: this one" puts $f "and this one" @@ -200,7 +197,7 @@ test iocmd-8.3 {fconfigure command} { list [catch {fconfigure a b} msg] $msg } {1 {can not find channel named "a"}} test iocmd-8.4 {fconfigure command} { - removeFile test1 + file delete $path(test1) set f1 [open $path(test1) w] set x [list [catch {fconfigure $f1 froboz} msg] $msg] close $f1 @@ -213,7 +210,7 @@ test iocmd-8.6 {fconfigure command} { list [catch {fconfigure stdin -translation froboz} msg] $msg } {1 {bad value for -translation: must be one of auto, binary, cr, lf, crlf, or platform}} test iocmd-8.7 {fconfigure command} { - removeFile test1 + file delete $path(test1) set f1 [open $path(test1) w] fconfigure $f1 -translation lf -eofchar {} -encoding unicode set x [fconfigure $f1] @@ -221,7 +218,7 @@ test iocmd-8.7 {fconfigure command} { set x } {-blocking 1 -buffering full -buffersize 4096 -encoding unicode -eofchar {} -translation lf} test iocmd-8.8 {fconfigure command} { - removeFile test1 + file delete $path(test1) set f1 [open $path(test1) w] fconfigure $f1 -translation lf -buffering line -buffersize 3030 \ -eofchar {} -encoding unicode @@ -232,7 +229,7 @@ test iocmd-8.8 {fconfigure command} { set x } {line {-blocking 1 -buffering line -buffersize 3030 -encoding unicode -eofchar {} -translation lf}} test iocmd-8.9 {fconfigure command} { - removeFile test1 + file delete $path(test1) set f1 [open $path(test1) w] fconfigure $f1 -translation binary -buffering none -buffersize 4040 \ -eofchar {} -encoding binary @@ -367,7 +364,7 @@ test iocmd-10.5 {fblocked command} { set path(test4) [makeFile {} test4] set path(test5) [makeFile {} test5] -removeFile test5 +file delete $path(test5) test iocmd-11.1 {I/O to command pipelines} {unixOrPc unixExecs} { set f [open $path(test4) w] close $f @@ -381,7 +378,7 @@ test iocmd-11.3 {I/O to command pipelines} {unixOrPc unixExecs} { } {1 {can't read output from command: standard output was redirected} NONE} test iocmd-12.1 {POSIX open access modes: RDONLY} { - removeFile test1 + file delete $path(test1) set f [open $path(test1) w] puts $f "Two lines: this one" puts $f "and this one" @@ -393,18 +390,18 @@ test iocmd-12.1 {POSIX open access modes: RDONLY} { "{Two lines: this one} 1 [list [format "channel \"%s\" wasn't opened for writing" $f]]" } 0 test iocmd-12.2 {POSIX open access modes: RDONLY} -match regexp -body { - removeFile test3 + file delete $path(test3) open $path(test3) RDONLY } -returnCodes error -result {(?i)couldn't open ".*test3": no such file or directory} test iocmd-12.3 {POSIX open access modes: WRONLY} -match regexp -body { - removeFile test3 + file delete $path(test3) open $path(test3) WRONLY } -returnCodes error -result {(?i)couldn't open ".*test3": no such file or directory} # # Test 13.4 relies on assigning the same channel name twice. # test iocmd-12.4 {POSIX open access modes: WRONLY} {unixOnly} { - removeFile test3 + file delete $path(test3) set f [open $path(test3) w] fconfigure $f -eofchar {} puts $f xyzzy @@ -423,7 +420,7 @@ test iocmd-12.4 {POSIX open access modes: WRONLY} {unixOnly} { string compare $x $y } 0 test iocmd-12.5 {POSIX open access modes: RDWR} -match regexp -body { - removeFile test3 + file delete $path(test3) open $path(test3) RDWR } -returnCodes error -result {(?i)couldn't open ".*test3": no such file or directory} test iocmd-12.6 {POSIX open access modes: errors} { @@ -439,6 +436,7 @@ test iocmd-12.7 {POSIX open access modes: errors} { test iocmd-12.8 {POSIX open access modes: errors} { list [catch {open $path(test3) {TRUNC CREAT}} msg] $msg } {1 {access mode must include either RDONLY, WRONLY, or RDWR}} +close [open $path(test3) w] test iocmd-13.1 {errors in open command} { list [catch {open} msg] $msg @@ -548,12 +546,12 @@ close $wfile # cleanup foreach file [list test1 test2 test3 test4] { - catch {::tcltest::removeFile $file} + removeFile $file } # delay long enough for background processes to finish after 500 -foreach file [list test5 pipe output] { - catch {::tcltest::removeFile $file} +foreach file [list test5] { + removeFile $file } -::tcltest::cleanupTests +cleanupTests return |