From ab2cff383bae8438e025d4f11ad7dfe7f2eecf17 Mon Sep 17 00:00:00 2001 From: dkf Date: Tue, 7 Jun 2005 20:52:24 +0000 Subject: Now for a real test of [chan truncate]... --- ChangeLog | 2 ++ tests/chan.test | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6f35d6e..aa7a75e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2005-06-07 Donal K. Fellows + * 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 -- cgit v0.12