diff options
author | andreas_kupries <akupries@shaw.ca> | 2008-04-10 20:58:58 (GMT) |
---|---|---|
committer | andreas_kupries <akupries@shaw.ca> | 2008-04-10 20:58:58 (GMT) |
commit | 79184ae1728ec523c9f5a3fc423924ced708d520 (patch) | |
tree | bee20c2b6b38088b533ed32bdc0f886184b73278 /tests/chanio.test | |
parent | 5bebcba8118f0caa944c8689eeb6fe0671e88f1b (diff) | |
download | tcl-79184ae1728ec523c9f5a3fc423924ced708d520.zip tcl-79184ae1728ec523c9f5a3fc423924ced708d520.tar.gz tcl-79184ae1728ec523c9f5a3fc423924ced708d520.tar.bz2 |
* generic/tclIOCmd.c (Tcl_FcopyObjCmd): Keeping check for negative
values, changed to not be an error, but behave like the special
value -1 (copy all, default).
* tests/iocmd.test (iocmd-15.{12,13}): Removed.
* tests/io.test (io-52.5{,a,b}): Reverted last change, added
* tests/chanio.test (chan-io-52.5{,a,b}): comment regarding the
meaning of -1, added two more testcases for other negative values,
and input wrapped to negative.
Diffstat (limited to 'tests/chanio.test')
-rw-r--r-- | tests/chanio.test | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/chanio.test b/tests/chanio.test index e5f2852..6ac7dbb 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -13,7 +13,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: chanio.test,v 1.9 2008/04/09 19:49:09 andreas_kupries Exp $ +# RCS: @(#) $Id: chanio.test,v 1.10 2008/04/10 20:58:59 andreas_kupries Exp $ if {[catch {package require tcltest 2}]} { chan puts stderr "Skipping tests in [info script]. tcltest 2 required." @@ -6541,13 +6541,47 @@ test chan-io-52.4 {TclCopyChannel} {fcopy} { chan close $f2 lappend result [file size $path(test1)] } {0 0 40} -test chan-io-52.5 {TclCopyChannel} {fcopy} { +test chan-io-52.5 {TclCopyChannel, all} {fcopy} { file delete $path(test1) set f1 [open $thisScript] set f2 [open $path(test1) w] chan configure $f1 -translation lf -blocking 0 chan configure $f2 -translation lf -blocking 0 - chan copy $f1 $f2 ;#-size -1 + chan copy $f1 $f2 -size -1 ;# -1 means 'copy all', same as if no -size specified. + set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] + chan close $f1 + chan close $f2 + set s1 [file size $thisScript] + set s2 [file size $path(test1)] + if {"$s1" == "$s2"} { + lappend result ok + } + set result +} {0 0 ok} +test chan-io-52.5a {TclCopyChannel, all, other negative value} {fcopy} { + file delete $path(test1) + set f1 [open $thisScript] + set f2 [open $path(test1) w] + chan configure $f1 -translation lf -blocking 0 + chan configure $f2 -translation lf -blocking 0 + chan copy $f1 $f2 -size -2 ;# < 0 behaves like -1, copy all + set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] + chan close $f1 + chan close $f2 + set s1 [file size $thisScript] + set s2 [file size $path(test1)] + if {"$s1" == "$s2"} { + lappend result ok + } + set result +} {0 0 ok} +test chan-io-52.5b {TclCopyChannel, all, wrap to negative value} {fcopy} { + file delete $path(test1) + set f1 [open $thisScript] + set f2 [open $path(test1) w] + chan configure $f1 -translation lf -blocking 0 + chan configure $f2 -translation lf -blocking 0 + chan copy $f1 $f2 -size 3221176172 ;# Wrapped to < 0, behaves like -1, copy all set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] chan close $f1 chan close $f2 |