summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authormdejong <mdejong@noemail.net>2002-01-25 23:06:57 (GMT)
committermdejong <mdejong@noemail.net>2002-01-25 23:06:57 (GMT)
commit4299ce4ddc06e034fba27f2c9065ac10cc19141a (patch)
tree75339e2bd4ffcbce34c5e3b7c788743e68e0c163 /tests/io.test
parenta05d2c7670008987246fc3b329292a305d96c0f4 (diff)
downloadtcl-4299ce4ddc06e034fba27f2c9065ac10cc19141a.zip
tcl-4299ce4ddc06e034fba27f2c9065ac10cc19141a.tar.gz
tcl-4299ce4ddc06e034fba27f2c9065ac10cc19141a.tar.bz2
Make -eofchar and -translation options read only for
server sockets. [Bug 496733] * generic/tclIO.c (Tcl_GetChannelOption, Tcl_SetChannelOption): Instead of returning nothing for the -translation option on a server socket, always return "auto". Return the empty string enclosed in quotes for the -eofchar option on a server socket. Fixup -eofchar usage message so that it matches the implementation. * tests/io.test: Add -eofchar tests and -translation tests to ensure options are read only on server sockets. * tests/socket.test: Update tests to account for -eofchar and -translation option changes. FossilOrigin-Name: 1c08e33e953d0680497528facc19905bafe5852e
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/io.test b/tests/io.test
index 62cee1f..148bdd5 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -12,7 +12,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.23 2002/01/21 20:38:06 andreas_kupries Exp $
+# RCS: @(#) $Id: io.test,v 1.24 2002/01/25 23:06:58 mdejong Exp $
if {[lsearch [namespace children] ::tcltest] == -1} {
package require tcltest
@@ -5028,6 +5028,37 @@ test io-39.21 {Tcl_SetChannelOption, setting read mode independently} \
close $s2
set modes
} {auto crlf}
+test io-39.22 {Tcl_SetChannelOption, invariance} {
+ removeFile test1
+ set f1 [open test1 w+]
+ set l ""
+ lappend l [fconfigure $f1 -eofchar]
+ fconfigure $f1 -eofchar {ON GO}
+ lappend l [fconfigure $f1 -eofchar]
+ fconfigure $f1 -eofchar D
+ lappend l [fconfigure $f1 -eofchar]
+ lappend l [list [catch {fconfigure $f1 -eofchar {1 2 3}} msg] $msg]
+ close $f1
+ set l
+} {{{} {}} {O G} {D D}\
+{1 {bad value for -eofchar: should be a list of zero, one, or two elements}}}
+test io-39.23 {Tcl_GetChannelOption, server socket is not readable or
+ writeable, it should still have valid -eofchar and -translation options } {
+ set l [list]
+ set sock [socket -server accept 0]
+ lappend l [fconfigure $sock -eofchar] [fconfigure $sock -translation]
+ close $sock
+ set l
+} {{{}} auto}
+test io-39.24 {Tcl_SetChannelOption, server socket is not readable or
+ writable so we can't change -eofchar or -translation } {
+ set l [list]
+ set sock [socket -server accept 0]
+ fconfigure $sock -eofchar D -translation lf
+ lappend l [fconfigure $sock -eofchar] [fconfigure $sock -translation]
+ close $sock
+ set l
+} {{{}} auto}
test io-40.1 {POSIX open access modes: RDWR} {
removeFile test3