summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorandreas_kupries <akupries@shaw.ca>2006-03-16 18:23:18 (GMT)
committerandreas_kupries <akupries@shaw.ca>2006-03-16 18:23:18 (GMT)
commit68c1d94957701240c5b06cdc75ae4a47d1a3cd7e (patch)
tree58b62966df348210cf51a6066e2b09bf37ac37ac /tests
parent278d6deed875d2e1041c37f225189680d09891bd (diff)
downloadtcl-68c1d94957701240c5b06cdc75ae4a47d1a3cd7e.zip
tcl-68c1d94957701240c5b06cdc75ae4a47d1a3cd7e.tar.gz
tcl-68c1d94957701240c5b06cdc75ae4a47d1a3cd7e.tar.bz2
* generic/tclIOUtil.c (TclGetOpenMode): Added the flag O_APPEND to
the list of POSIX modes used when opening a file for 'a'ppend. This enables the proper automatic seek-to-end-on-write by the OS. See [Bug 680143] for longer discussion. * tests/ioCmd.test (iocmd-13.7.*): Extended the testsuite to check the new handling of 'a'.
Diffstat (limited to 'tests')
-rw-r--r--tests/ioCmd.test39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index 448b222..29ddba7 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -1,3 +1,4 @@
+# -*- tcl -*-
# Commands covered: open, close, gets, read, puts, seek, tell, eof, flush,
# fblocked, fconfigure, open, channel, fcopy
#
@@ -12,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: ioCmd.test,v 1.16.2.2 2003/10/07 18:53:23 dgp Exp $
+# RCS: @(#) $Id: ioCmd.test,v 1.16.2.3 2006/03/16 18:23:24 andreas_kupries Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -459,6 +460,42 @@ test iocmd-13.6 {errors in open command} {
string tolower $msg
} {1 {couldn't open "_non_existent_": no such file or directory} {posix enoent {no such file or directory}}}
+
+test iocmd-13.7.1 {open for append, a mode} -setup {
+ set log [makeFile {} out]
+ set chans {}
+} -body {
+ foreach i { 0 1 2 3 4 5 6 7 8 9 } {
+ puts [set ch [open $log a]] $i
+ lappend chans $ch
+ }
+ foreach ch $chans {catch {close $ch}}
+ lsort [split [string trim [viewFile out]] \n]
+} -cleanup {
+ removeFile out
+ # Ensure that channels are gone, even if body failed to do so
+ foreach ch $chans {catch {close $ch}}
+} -result {0 1 2 3 4 5 6 7 8 9}
+
+test iocmd-13.7.2 {open for append, O_APPEND} -setup {
+ set log [makeFile {} out]
+ set chans {}
+} -body {
+ foreach i { 0 1 2 3 4 5 6 7 8 9 } {
+ puts [set ch [open $log {WRONLY CREAT APPEND}]] $i
+ lappend chans $ch
+ }
+ foreach ch $chans {catch {close $ch}}
+ lsort [split [string trim [viewFile out]] \n]
+} -cleanup {
+ removeFile out
+ # Ensure that channels are gone, even if body failed to do so
+ foreach ch $chans {catch {close $ch}}
+} -result {0 1 2 3 4 5 6 7 8 9}
+
+
+
+
test iocmd-14.1 {file id parsing errors} {
list [catch {eof gorp} msg] $msg $errorCode
} {1 {can not find channel named "gorp"} NONE}