diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-21 20:37:14 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-21 20:37:14 (GMT) |
commit | 51de10f5fb0741a2377d6816d0825dd1d1b4827f (patch) | |
tree | 025dd4aa16093aad14b7b869e211382957b02a88 | |
parent | 1b693e0f2e7f00edc0575fb022102d9b3e2a23f5 (diff) | |
parent | 6c8d3a5bc702b2abd059c9a1dc733e9add134304 (diff) | |
download | tcl-51de10f5fb0741a2377d6816d0825dd1d1b4827f.zip tcl-51de10f5fb0741a2377d6816d0825dd1d1b4827f.tar.gz tcl-51de10f5fb0741a2377d6816d0825dd1d1b4827f.tar.bz2 |
Revise use of "-translation binary" in testcases: Use it where usefull, don't use it any more where misleading
-rw-r--r-- | tests-perf/chan.perf.tcl | 6 | ||||
-rw-r--r-- | tests/chanio.test | 20 | ||||
-rw-r--r-- | tests/encoding.test | 8 | ||||
-rw-r--r-- | tests/ioCmd.test | 5 |
4 files changed, 19 insertions, 20 deletions
diff --git a/tests-perf/chan.perf.tcl b/tests-perf/chan.perf.tcl index 2ef87cb..bf0de09 100644 --- a/tests-perf/chan.perf.tcl +++ b/tests-perf/chan.perf.tcl @@ -27,12 +27,12 @@ namespace path {::tclTestPerf} proc _get_test_chan {{bufSize 4096}} { lassign [chan pipe] ch wch; - fconfigure $ch -translation binary -encoding utf-8 -buffersize $bufSize -buffering full - fconfigure $wch -translation binary -encoding utf-8 -buffersize $bufSize -buffering full + fconfigure $ch -translation lf -encoding utf-8 -buffersize $bufSize -buffering full + fconfigure $wch -translation lf -encoding utf-8 -buffersize $bufSize -buffering full exec [info nameofexecutable] -- $bufSize >@$wch << { set bufSize [lindex $::argv end] - fconfigure stdout -translation binary -encoding utf-8 -buffersize $bufSize -buffering full + fconfigure stdout -translation lf -encoding utf-8 -buffersize $bufSize -buffering full set buf [string repeat test 1000]; # 4K # write ~ 10*1M + 10*2M + 10*10M + 1*20M: set i 0; while {$i < int((10*1e6 + 10*2e6 + 10*10e6 + 1*20e6)/4e3)} { diff --git a/tests/chanio.test b/tests/chanio.test index e95a0ca..ce166aa 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -6735,8 +6735,8 @@ test chan-io-52.5 {TclCopyChannel, all} -constraints {fcopy} -setup { } -body { set f1 [open $thisScript] set f2 [open $path(test1) w] - chan configure $f1 -translation lf -encoding iso8859-1 -blocking 0 - chan configure $f2 -translation lf -encoding iso8859-1 -blocking 0 + chan configure $f1 -translation binary -blocking 0 + chan configure $f2 -translation binary -blocking 0 chan copy $f1 $f2 -size -1 ;# -1 means 'copy all', same as if no -size specified. set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] chan close $f1 @@ -6751,8 +6751,8 @@ test chan-io-52.5a {TclCopyChannel, all, other negative value} -setup { } -constraints {fcopy} -body { set f1 [open $thisScript] set f2 [open $path(test1) w] - chan configure $f1 -translation lf -encoding iso8859-1 -blocking 0 - chan configure $f2 -translation lf -encoding iso8859-1 -blocking 0 + chan configure $f1 -translation binary -blocking 0 + chan configure $f2 -translation binary -blocking 0 chan copy $f1 $f2 -size -2 ;# < 0 behaves like -1, copy all set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] chan close $f1 @@ -6767,8 +6767,8 @@ test chan-io-52.5b {TclCopyChannel, all, wrap to negative value} -setup { } -constraints {fcopy} -body { set f1 [open $thisScript] set f2 [open $path(test1) w] - chan configure $f1 -translation lf -encoding iso8859-1 -blocking 0 - chan configure $f2 -translation lf -encoding iso8859-1 -blocking 0 + chan configure $f1 -translation binary -blocking 0 + chan configure $f2 -translation binary -blocking 0 chan copy $f1 $f2 -size 3221176172 ;# Wrapped to < 0, behaves like -1, copy all set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] chan close $f1 @@ -6783,8 +6783,8 @@ test chan-io-52.6 {TclCopyChannel} -setup { } -constraints {fcopy} -body { set f1 [open $thisScript] set f2 [open $path(test1) w] - chan configure $f1 -translation lf -encoding iso8859-1 -blocking 0 - chan configure $f2 -translation lf -encoding iso8859-1 -blocking 0 + chan configure $f1 -translation binary -blocking 0 + chan configure $f2 -translation binary -blocking 0 set s0 [chan copy $f1 $f2 -size [expr {[file size $thisScript] + 5}]] set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] chan close $f1 @@ -6801,8 +6801,8 @@ test chan-io-52.7 {TclCopyChannel} -constraints {fcopy} -setup { } -body { set f1 [open $thisScript] set f2 [open $path(test1) w] - chan configure $f1 -translation lf -encoding iso8859-1 -blocking 0 - chan configure $f2 -translation lf -encoding iso8859-1 -blocking 0 + chan configure $f1 -translation binary -blocking 0 + chan configure $f2 -translation binary -blocking 0 chan copy $f1 $f2 set result [list [chan configure $f1 -blocking] [chan configure $f2 -blocking]] if {[file size $thisScript] == [file size $path(test1)]} { diff --git a/tests/encoding.test b/tests/encoding.test index 10a7400..348df86 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -189,11 +189,11 @@ test encoding-7.2 {Tcl_UtfToExternalDString: big buffer} { test encoding-8.1 {Tcl_ExternalToUtf} { set f [open [file join [temporaryDirectory] dummy] w] - fconfigure $f -translation binary -encoding iso8859-1 + fconfigure $f -translation binary puts -nonewline $f "ab\x8C\xC1g" close $f set f [open [file join [temporaryDirectory] dummy] r] - fconfigure $f -translation binary -encoding shiftjis + fconfigure $f -translation lf -encoding shiftjis set x [read $f] close $f file delete [file join [temporaryDirectory] dummy] @@ -217,11 +217,11 @@ test encoding-9.2 {Tcl_UtfToExternalDString: big buffer} { test encoding-10.1 {Tcl_UtfToExternal} { set f [open [file join [temporaryDirectory] dummy] w] - fconfigure $f -translation binary -encoding shiftjis + fconfigure $f -translation lf -encoding shiftjis puts -nonewline $f ab乎g close $f set f [open [file join [temporaryDirectory] dummy] r] - fconfigure $f -translation binary -encoding iso8859-1 + fconfigure $f -translation binary set x [read $f] close $f file delete [file join [temporaryDirectory] dummy] diff --git a/tests/ioCmd.test b/tests/ioCmd.test index 07cf3cd..6d5fcef 100644 --- a/tests/ioCmd.test +++ b/tests/ioCmd.test @@ -62,7 +62,7 @@ test iocmd-1.7 {puts command} { } 7 test iocmd-1.8 {puts command} { set f [open $path(test1) w] - fconfigure $f -translation lf -eofchar {} -encoding iso8859-1 + fconfigure $f -translation binary puts -nonewline $f [binary format a4a5 foo bar] close $f file size $path(test1) @@ -262,8 +262,7 @@ test iocmd-8.9 {fconfigure command} -setup { file delete $path(test1) } -body { set f1 [open $path(test1) w] - fconfigure $f1 -translation binary -buffering none -buffersize 4040 \ - -eofchar {} -encoding binary + fconfigure $f1 -translation binary -buffering none -buffersize 4040 fconfigure $f1 } -cleanup { catch {close $f1} |