summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordkf <donal.k.fellows@manchester.ac.uk>2005-06-07 20:52:24 (GMT)
committerdkf <donal.k.fellows@manchester.ac.uk>2005-06-07 20:52:24 (GMT)
commitab2cff383bae8438e025d4f11ad7dfe7f2eecf17 (patch)
tree72236ad98b731fe78a821d012097e7fc3eef606a
parentfd60ef760f6d2e1800d6ea0b34d2d8e238cee1d2 (diff)
downloadtcl-ab2cff383bae8438e025d4f11ad7dfe7f2eecf17.zip
tcl-ab2cff383bae8438e025d4f11ad7dfe7f2eecf17.tar.gz
tcl-ab2cff383bae8438e025d4f11ad7dfe7f2eecf17.tar.bz2
Now for a real test of [chan truncate]...
-rw-r--r--ChangeLog2
-rw-r--r--tests/chan.test15
2 files changed, 16 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 6f35d6e..aa7a75e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2005-06-07 Donal K. Fellows <dkf@users.sf.net>
+ * tests/chan.test (chan-15.2): Added real test of truncation.
+
* generic/tclIO.c (Tcl_ChannelTruncateProc): Stop proliferation of
* generic/tcl.h: channel type versions
* doc/CrtChannel.3: following advice from AKu
diff --git a/tests/chan.test b/tests/chan.test
index 93cadc9..cf83820 100644
--- a/tests/chan.test
+++ b/tests/chan.test
@@ -7,7 +7,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: chan.test,v 1.2 2005/06/07 10:05:01 dkf Exp $
+# RCS: @(#) $Id: chan.test,v 1.3 2005/06/07 20:52:25 dkf Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest 2
@@ -76,6 +76,19 @@ test chan-14.1 {chan command: tell subcommand} -body {
test chan-15.1 {chan command: truncate subcommand} -body {
chan truncate foo bar foo bar
} -returnCodes error -result "wrong \# args: should be \"chan truncate channelId ?length?\""
+test chan-15.2 {chan command: truncate subcommand} -constraints unix -setup {
+ set file [makeFile {} testTruncate]
+ set f [open $file w+]
+} -body {
+ fconfigure $f -translation binary
+ puts -nonewline $f 12345
+ seek $f 0
+ chan truncate $f 2
+ read $f
+} -result 12 -cleanup {
+ catch {close $f}
+ catch {removeFile $file}
+}
cleanupTests
return