summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/chanio.test1
-rw-r--r--tests/io.test45
2 files changed, 25 insertions, 21 deletions
diff --git a/tests/chanio.test b/tests/chanio.test
index e7a125b..69f9690 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -6881,6 +6881,7 @@ test chan-io-52.10 {TclCopyChannel & encodings} -constraints {fcopy} -body {
} -cleanup {
chan close $in
chan close $out
+ unset in out
} -returnCodes 1 -match glob -result {error writing "*":\
invalid or incomplete multibyte or wide character}
test chan-io-52.11 {TclCopyChannel & encodings} -setup {
diff --git a/tests/io.test b/tests/io.test
index d79cfb8..2f2fb68 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -1614,7 +1614,7 @@ test io-12.8 {ReadChars: multibyte chars split} {
close $f
scan [string index $in end] %c
} 160
-test {io-12.9 profile tcl8} {ReadChars: multibyte chars split} -body {
+test io-12.9 {ReadChars: multibyte chars split} -body {
set f [open $path(test1) w]
fconfigure $f -translation binary
puts -nonewline $f [string repeat a 9]\xC2
@@ -1627,7 +1627,7 @@ test {io-12.9 profile tcl8} {ReadChars: multibyte chars split} -body {
} -cleanup {
catch {close $f}
} -result 194
-test {io-12.10 strict} {ReadChars: multibyte chars split} -body {
+test io-12.11 {ReadChars: multibyte chars split} -body {
set f [open $path(test1) w]
fconfigure $f -translation binary
puts -nonewline $f [string repeat a 9]\xC2
@@ -1641,9 +1641,7 @@ test {io-12.10 strict} {ReadChars: multibyte chars split} -body {
catch {close $f}
} -returnCodes 1 -match glob -result {error reading "file*":\
invalid or incomplete multibyte or wide character}
-
-
-test {io-12.10 tcl8} {ReadChars: multibyte chars split} -body {
+test io-12.12 {ReadChars: multibyte chars split} -body {
set f [open $path(test1) w]
fconfigure $f -translation binary
puts -nonewline $f [string repeat a 9]\xC2
@@ -5871,7 +5869,7 @@ test io-39.22a {Tcl_SetChannelOption, invariance} -constraints deprecated -body
set l
} -result {O D {1 {bad value for -eofchar: must be non-NUL ASCII character}}}
test io-39.23 {Tcl_GetChannelOption, server socket is not readable or
- writable, it should still have valid -eofchar and -translation options } {
+ writable, it should still have valid -eofchar and -translation options } {
set l [list]
set sock [socket -server [namespace code accept] -myaddr 127.0.0.1 0]
lappend l [fconfigure $sock -eofchar] [fconfigure $sock -translation]
@@ -5879,7 +5877,7 @@ test io-39.23 {Tcl_GetChannelOption, server socket is not readable or
set l
} {{} auto}
test io-39.24 {Tcl_SetChannelOption, server socket is not readable or
- writable so we can't change -eofchar or -translation } {
+ writable so we can't change -eofchar or -translation } {
set l [list]
set sock [socket -server [namespace code accept] -myaddr 127.0.0.1 0]
fconfigure $sock -eofchar D -translation lf
@@ -9317,6 +9315,7 @@ test io-75.7 {
} -cleanup {
close $f
removeFile io-75.7
+ unset msg f fn
} -match glob -result {1 {error reading "file*":\
invalid or incomplete multibyte or wide character}}
@@ -9354,17 +9353,16 @@ test io-75.8.eoflater {invalid utf-8 encoding eof handling (-profile strict)} -s
fconfigure $f -encoding utf-8 -buffering none -eofchar \x1A \
-translation lf -profile strict
} -body {
- set res [list [catch {read $f} cres] [eof $f]]
+ set res [list [catch {read $f} msg] [eof $f]]
chan configure $f -encoding iso8859-1
lappend res [read $f 1]
chan configure $f -encoding utf-8
- catch {read $f 1} cres
- lappend res $cres
- close $f
- set res
+ lappend res [catch {read $f 1} msg] $msg
} -cleanup {
+ close $f
removeFile io-75.8
-} -match glob -result "1 0 \x81 {error reading \"*\":\
+ unset res msg fn f
+} -match glob -result "1 0 \x81 1 {error reading \"*\":\
invalid or incomplete multibyte or wide character}"
@@ -9373,7 +9371,6 @@ test io-strict-multibyte-eof {
See issue 25cdcb7e8fb381fb
} -setup {
- set res {}
set chan [file tempfile];
fconfigure $chan -encoding binary
puts -nonewline $chan \x81\x1A
@@ -9381,10 +9378,10 @@ test io-strict-multibyte-eof {
seek $chan 0
chan configure $chan -encoding utf-8 -profile strict
} -body {
- list [catch {read $chan 1} cres] $cres
+ list [catch {read $chan 1} msg] $msg
} -cleanup {
close $chan
- unset res
+ unset msg chan
} -match glob -result {1 {error reading "*":\
invalid or incomplete multibyte or wide character}}
@@ -9400,6 +9397,7 @@ test io-75.9 {unrepresentable character write passes and is replaced by ?} -setu
} -cleanup {
close $f
removeFile io-75.9
+ unset f
} -match glob -result [list {A} {error writing "*":\
invalid or incomplete multibyte or wide character}]
@@ -9454,6 +9452,7 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup {
} -cleanup {
close $f
removeFile io-75.11
+ unset d hd msg f
} -match glob -result {41 1 {error reading "file*":\
invalid or incomplete multibyte or wide character}}
@@ -9505,6 +9504,7 @@ test io-75.13 {
} -cleanup {
close $f
removeFile io-75.13
+ unset d hd msg f fn
} -match glob -result {41 1 {error reading "file*":\
invalid or incomplete multibyte or wide character}}
@@ -9522,14 +9522,16 @@ test io-75.14 {
fconfigure $chan -encoding utf-8 -buffering none -eofchar {} \
-translation auto -profile strict
} -body {
+ set res [gets $chan]
lappend res [gets $chan]
- lappend res [gets $chan]
- lappend res [catch {gets $chan} cres] $cres
+ lappend res [catch {gets $chan} msg] $msg
chan configure $chan -profile tcl8
lappend res [gets $chan]
lappend res [gets $chan]
- close $chan
return $res
+} -cleanup {
+ close $chan
+ unset chan res msg
} -match glob -result {a b 1 {error reading "*":\
invalid or incomplete multibyte or wide character} cÀ d}
@@ -9549,8 +9551,8 @@ test io-75.15 {
fconfigure $chan -encoding utf-8 -profile strict
lappend res [gets $chan]
lappend res [gets $chan]
- lappend res [catch {gets $chan} cres] $cres
- lappend res [catch {gets $chan} cres] $cres
+ lappend res [catch {gets $chan} msg] $msg
+ lappend res [catch {gets $chan} msg] $msg
chan configure $chan -translation binary
set data [read $chan 4]
foreach char [split $data {}] {
@@ -9563,6 +9565,7 @@ test io-75.15 {
return $res
} -cleanup {
close $chan
+ unset chan res msg data
} -match glob -result {hello AB 1 {error reading "*": invalid or incomplete multibyte or wide character}\
1 {error reading "*": invalid or incomplete multibyte or wide character} 43 44 c0 40 EF GHI}