summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorpooryorick <com.digitalsmarties@pooryorick.com>2023-04-06 10:03:49 (GMT)
committerpooryorick <com.digitalsmarties@pooryorick.com>2023-04-06 10:03:49 (GMT)
commit1c1cbe4444dd361c05d21208a775bbaca087a142 (patch)
tree425c06f3b58132323040de95926d091a91057777 /tests
parent3749d89fa657cafe57cc3eb475fcc6c136f507f0 (diff)
downloadtcl-1c1cbe4444dd361c05d21208a775bbaca087a142.zip
tcl-1c1cbe4444dd361c05d21208a775bbaca087a142.tar.gz
tcl-1c1cbe4444dd361c05d21208a775bbaca087a142.tar.bz2
Further fix for [fa3d9fd818fa0072]. In ChannelState.encoding, NULL no longer
represents the binary encoding.
Diffstat (limited to 'tests')
-rw-r--r--tests/chanio.test5
-rw-r--r--tests/io.test58
-rw-r--r--tests/ioCmd.test3
-rw-r--r--tests/zlib.test4
4 files changed, 48 insertions, 22 deletions
diff --git a/tests/chanio.test b/tests/chanio.test
index c3caa1c..d13aaab 100644
--- a/tests/chanio.test
+++ b/tests/chanio.test
@@ -6868,7 +6868,7 @@ test chan-io-52.9 {TclCopyChannel & encodings} {fcopy} {
[file size $path(utf8-fcopy.txt)] \
[file size $path(utf8-rp.txt)]
} {3 5 5}
-test chan-io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} {
+test chan-io-52.10 {TclCopyChannel & encodings} -constraints {fcopy} -body {
# encoding to binary (=> implies that the internal utf-8 is written)
set in [open $path(kyrillic.txt) r]
set out [open $path(utf8-fcopy.txt) w]
@@ -6879,7 +6879,8 @@ test chan-io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} {
chan close $in
chan close $out
file size $path(utf8-fcopy.txt)
-} 5
+} -returnCodes 1 -match glob -result {error writing "*":\
+ invalid or incomplete multibyte or wide character}
test chan-io-52.11 {TclCopyChannel & encodings} -setup {
set f [open $path(utf8-fcopy.txt) w]
fconfigure $f -encoding utf-8 -translation lf
diff --git a/tests/io.test b/tests/io.test
index 5fd255c..fe0a580 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -7500,7 +7500,7 @@ test io-52.9 {TclCopyChannel & encodings} {fcopy} {
[file size $path(utf8-fcopy.txt)] \
[file size $path(utf8-rp.txt)]
} {3 5 5}
-test io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} {
+test io-52.10 {TclCopyChannel & encodings} -constraints fcopy -body {
# encoding to binary (=> implies that the
# internal utf-8 is written)
@@ -7516,7 +7516,8 @@ test io-52.10 {TclCopyChannel & encodings} {fcopy notWinCI} {
close $out
file size $path(utf8-fcopy.txt)
-} 5
+} -returnCodes 1 -match glob -result {error writing "*":\
+ invalid or incomplete multibyte or wide character}
test io-52.11 {TclCopyChannel & encodings} -setup {
set out [open $path(utf8-fcopy.txt) w]
fconfigure $out -encoding utf-8 -translation lf -profile strict
@@ -8374,7 +8375,7 @@ test io-53.13 {TclCopyChannel: read error reporting} -setup {
catch {close $out}
removeFile out
rename driver {}
-} -result {error reading "*": *} -returnCodes error -match glob
+} -result {error reading "rc*": *} -returnCodes error -match glob
test io-53.14 {TclCopyChannel: write error reporting} -setup {
proc driver {cmd args} {
variable buffer
@@ -9264,7 +9265,7 @@ test io-75.5 {invalid utf-8 encoding read is ignored (-profile tcl8)} -setup {
removeFile io-75.5
} -result 4181
-test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup {
+test io-75.6 {invalid utf-8 encoding, gets is not ignored (-profile strict)} -setup {
set fn [makeFile {} io-75.6]
set f [open $fn w+]
fconfigure $f -encoding binary
@@ -9278,7 +9279,8 @@ test io-75.6 {invalid utf-8 encoding gets is not ignored (-profile strict)} -set
} -cleanup {
close $f
removeFile io-75.6
-} -match glob -returnCodes 1 -result {error reading "*": invalid or incomplete multibyte or wide character}
+} -match glob -returnCodes 1 -result {error reading "file*":\
+ invalid or incomplete multibyte or wide character}
test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -setup {
set fn [makeFile {} io-75.7]
@@ -9294,7 +9296,8 @@ test io-75.7 {invalid utf-8 encoding gets is not ignored (-profile strict)} -set
} -cleanup {
close $f
removeFile io-75.7
-} -match glob -returnCodes 1 -result {error reading "*": invalid or incomplete multibyte or wide character}
+} -match glob -returnCodes 1 -result {error reading "file*":\
+ invalid or incomplete multibyte or wide character}
test io-75.8 {invalid utf-8 encoding eof handling (-profile strict)} -setup {
set fn [makeFile {} io-75.8]
@@ -9330,10 +9333,11 @@ test io-75.9 {unrepresentable character write passes and is replaced by ?} -setu
removeFile io-75.9
} -match glob -result [list {A} {error writing "*": invalid or incomplete multibyte or wide character}]
-# Incomplete sequence test.
-# This error may IMHO only be detected with the close.
-# But the read already returns the incomplete sequence.
-test io-75.10 {incomplete multibyte encoding read is ignored} -setup {
+test io-75.10 {
+ incomplete multibyte encoding read is not ignored because "binary" sets
+ profile to strict
+} -setup {
+ set res {}
set fn [makeFile {} io-75.10]
set f [open $fn w+]
fconfigure $f -encoding binary
@@ -9342,13 +9346,21 @@ test io-75.10 {incomplete multibyte encoding read is ignored} -setup {
seek $f 0
fconfigure $f -encoding utf-8 -buffering none
} -body {
+ catch {read $f} errmsg
+ lappend res $errmsg
+ seek $f 0
+ chan configure $f -profile tcl8
set d [read $f]
binary scan $d H* hd
- set hd
+ lappend res $hd
+ return $res
} -cleanup {
close $f
removeFile io-75.10
-} -result 41c0
+ unset result
+} -match glob -result {{error reading "file*":\
+ invalid or incomplete multibyte or wide character} 41c0}
+
# The current result returns the orphan byte as byte.
# This may be expected due to special utf-8 handling.
@@ -9372,9 +9384,14 @@ test io-75.11 {shiftjis encoding error read results in raw bytes} -setup {
} -cleanup {
close $f
removeFile io-75.11
-} -match glob -result {41 1 {error reading "*": invalid or incomplete multibyte or wide character}}
+} -match glob -result {41 1 {error reading "file*":\
+ invalid or incomplete multibyte or wide character}}
-test io-75.12 {invalid utf-8 encoding read is ignored} -setup {
+test io-75.12 {
+ invalid utf-8 encoding read is not ignored because setting the encoding to
+ "binary" also set the profile to strict
+} -setup {
+ set res {}
set fn [makeFile {} io-75.12]
set f [open $fn w+]
fconfigure $f -encoding binary
@@ -9383,13 +9400,20 @@ test io-75.12 {invalid utf-8 encoding read is ignored} -setup {
seek $f 0
fconfigure $f -encoding utf-8 -buffering none -eofchar "" -translation lf
} -body {
+ catch {read $f} errmsg
+ lappend res $errmsg
+ chan configure $f -profile tcl8
+ seek $f 0
set d [read $f]
binary scan $d H* hd
- set hd
+ lappend res $hd
+ return $res
} -cleanup {
close $f
removeFile io-75.12
-} -result 4181
+ unset res
+} -match glob -result {{error reading "file*":\
+ invalid or incomplete multibyte or wide character} 4181}
test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -setup {
set fn [makeFile {} io-75.13]
set f [open $fn w+]
@@ -9407,7 +9431,7 @@ test io-75.13 {invalid utf-8 encoding read is not ignored (-profile strict)} -se
} -cleanup {
close $f
removeFile io-75.13
-} -match glob -result {41 1 {error reading "*": invalid or incomplete multibyte or wide character}}
+} -match glob -result {41 1 {error reading "file*": invalid or incomplete multibyte or wide character}}
# ### ### ### ######### ######### #########
diff --git a/tests/ioCmd.test b/tests/ioCmd.test
index cab4745..2df2ca0 100644
--- a/tests/ioCmd.test
+++ b/tests/ioCmd.test
@@ -266,7 +266,7 @@ test iocmd-8.9 {fconfigure command} -setup {
fconfigure $f1
} -cleanup {
catch {close $f1}
-} -result {-blocking 1 -buffering none -buffersize 4040 -encoding binary -eofchar {} -profile tcl8 -translation lf}
+} -result {-blocking 1 -buffering none -buffersize 4040 -encoding iso8859-1 -eofchar {} -profile tcl8 -translation lf}
test iocmd-8.10 {fconfigure command} -returnCodes error -body {
fconfigure a b
} -result {can not find channel named "a"}
@@ -496,6 +496,7 @@ test iocmd-12.10 {POSIX open access modes: BINARY} {
set result
} 5
test iocmd-12.11 {POSIX open access modes: BINARY} -body {
+ after 100
set f [open $path(test1) {WRONLY BINARY TRUNC}]
puts $f Ɉ ;# throws an exception
} -cleanup {
diff --git a/tests/zlib.test b/tests/zlib.test
index 720fdd6..93c568b 100644
--- a/tests/zlib.test
+++ b/tests/zlib.test
@@ -292,7 +292,7 @@ test zlib-8.6 {transformation and fconfigure} -setup {
} -cleanup {
catch {close $fd}
removeFile $file
-} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf -checksum 1 -dictionary {}} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf}}
+} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf -checksum 1 -dictionary {}} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf}}
test zlib-8.7 {transformation and fconfigure} -setup {
set file [makeFile {} test.gz]
set fd [open $file wb]
@@ -302,7 +302,7 @@ test zlib-8.7 {transformation and fconfigure} -setup {
} -cleanup {
catch {close $fd}
removeFile $file
-} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf -checksum 0} {-blocking 1 -buffering full -buffersize 4096 -encoding binary -eofchar {} -profile tcl8 -translation lf}}
+} -result {{-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf -checksum 0} {-blocking 1 -buffering full -buffersize 4096 -encoding iso8859-1 -eofchar {} -profile strict -translation lf}}
# Input is headers from fetching SPDY draft
# Dictionary is that which is proposed _in_ SPDY draft
set spdyHeaders "HTTP/1.0 200 OK\r\nContent-Type: text/html; charset=utf-8\r\nX-Robots-Tag: noarchive\r\nLast-Modified: Tue, 05 Jun 2012 02:43:25 GMT\r\nETag: \"1338864205129|#public|0|en|||0\"\r\nExpires: Tue, 05 Jun 2012 16:17:11 GMT\r\nDate: Tue, 05 Jun 2012 16:17:06 GMT\r\nCache-Control: public, max-age=5\r\nX-Content-Type-Options: nosniff\r\nX-XSS-Protection: 1; mode=block\r\nServer: GSE\r\n"