summaryrefslogtreecommitdiffstats
path: root/tests/io.test
diff options
context:
space:
mode:
authorapnadkarni <apnmbx-wits@yahoo.com>2023-02-28 15:39:09 (GMT)
committerapnadkarni <apnmbx-wits@yahoo.com>2023-02-28 15:39:09 (GMT)
commit74b7d6bc14c2f441f2719ddfbf6207d9e49788cd (patch)
treea83e2e5f035a721c5a0eb8ea782a809f019b4faf /tests/io.test
parent3d177bd8b588eb3f64773a86cabc290208e031a5 (diff)
parent4227ef37bbd67235ead035bb544b3bcf864b1e87 (diff)
downloadtcl-74b7d6bc14c2f441f2719ddfbf6207d9e49788cd.zip
tcl-74b7d6bc14c2f441f2719ddfbf6207d9e49788cd.tar.gz
tcl-74b7d6bc14c2f441f2719ddfbf6207d9e49788cd.tar.bz2
Merge 8.7
Diffstat (limited to 'tests/io.test')
-rw-r--r--tests/io.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/io.test b/tests/io.test
index c33646a..66dee7d 100644
--- a/tests/io.test
+++ b/tests/io.test
@@ -7609,6 +7609,27 @@ test io-52.19 {coverage of eofChar handling} {
close $out
file size $path(test2)
} 8
+test io-52.20 {TclCopyChannel & encodings} -setup {
+ set out [open $path(utf8-fcopy.txt) w]
+ fconfigure $out -encoding utf-8 -translation lf
+ puts $out "Á"
+ close $out
+} -constraints {fcopy} -body {
+ # binary to encoding => the input has to be
+ # in utf-8 to make sense to the encoder
+
+ set in [open $path(utf8-fcopy.txt) r]
+ set out [open $path(kyrillic.txt) w]
+
+ # Using "-encoding ascii" means reading the "Á" gives an error
+ fconfigure $in -encoding ascii -strictencoding 1
+ fconfigure $out -encoding koi8-r -translation lf
+
+ fcopy $in $out
+} -cleanup {
+ close $in
+ close $out
+} -returnCodes 1 -match glob -result {error reading "file*": illegal byte sequence}
test io-52.21 {TclCopyChannel & encodings} -setup {
set out [open $path(utf8-fcopy.txt) w]
fconfigure $out -encoding utf-8 -translation lf