summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2008-04-10 20:55:25 (GMT)
committerandreas_kupries <akupries@shaw.ca>2008-04-10 20:55:25 (GMT)
commitbc0c76f942f4b2bbeb5fc0ed30a832b6fa0ea93d (patch)
tree5759c7413cef93580234aa0308a0546156c5eb11 /tests/io.test
parentd3b620c65854c8ff37d4e90fa7c04c980a2af171 (diff)
downloadtcl-bc0c76f942f4b2bbeb5fc0ed30a832b6fa0ea93d.zip
tcl-bc0c76f942f4b2bbeb5fc0ed30a832b6fa0ea93d.tar.gz
tcl-bc0c76f942f4b2bbeb5fc0ed30a832b6fa0ea93d.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/io.test')
-rw-r--r--tests/io.test40
1 files changed, 37 insertions, 3 deletions
diff --git a/tests/io.test b/tests/io.test
index 45e7338..6ec186c 100644
--- a/tests/io.test
+++ b/tests/io.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: io.test,v 1.80.2.7 2008/04/09 19:51:12 andreas_kupries Exp $
+# RCS: @(#) $Id: io.test,v 1.80.2.8 2008/04/10 20:55:27 andreas_kupries Exp $
if {[catch {package require tcltest 2}]} {
puts stderr "Skipping tests in [info script]. tcltest 2 required."
@@ -6541,13 +6541,47 @@ test io-52.4 {TclCopyChannel} {fcopy} {
close $f2
lappend result [file size $path(test1)]
} {0 0 40}
-test io-52.5 {TclCopyChannel} {fcopy} {
+test io-52.5 {TclCopyChannel, all} {fcopy} {
file delete $path(test1)
set f1 [open $thisScript]
set f2 [open $path(test1) w]
fconfigure $f1 -translation lf -blocking 0
fconfigure $f2 -translation lf -blocking 0
- fcopy $f1 $f2 ;#-size -1
+ fcopy $f1 $f2 -size -1 ;# -1 means 'copy all', same as if no -size specified.
+ set result [list [fconfigure $f1 -blocking] [fconfigure $f2 -blocking]]
+ close $f1
+ 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 io-52.5a {TclCopyChannel, all, other negative value} {fcopy} {
+ file delete $path(test1)
+ set f1 [open $thisScript]
+ set f2 [open $path(test1) w]
+ fconfigure $f1 -translation lf -blocking 0
+ fconfigure $f2 -translation lf -blocking 0
+ fcopy $f1 $f2 -size -2 ;# < 0 behaves like -1, copy all
+ set result [list [fconfigure $f1 -blocking] [fconfigure $f2 -blocking]]
+ close $f1
+ 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 io-52.5b {TclCopyChannel, all, wrapped to negative value} {fcopy} {
+ file delete $path(test1)
+ set f1 [open $thisScript]
+ set f2 [open $path(test1) w]
+ fconfigure $f1 -translation lf -blocking 0
+ fconfigure $f2 -translation lf -blocking 0
+ fcopy $f1 $f2 -size 3221176172 ;# Wrapped to < 0, behaves like -1, copy all
set result [list [fconfigure $f1 -blocking] [fconfigure $f2 -blocking]]
close $f1
close $f2