diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-21 17:08:53 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2024-06-21 17:08:53 (GMT) |
commit | ef86c6216a8477062508de7d672bf55bffec9e18 (patch) | |
tree | e0b05aa79d016ea7df733e28762772db7437c5cc | |
parent | 43044c4c6faa38551b3d808f7be2675b73fd67e3 (diff) | |
parent | f82e67e7bfa7df973c5d4fc862b964c90ec5b72c (diff) | |
download | tcl-ef86c6216a8477062508de7d672bf55bffec9e18.zip tcl-ef86c6216a8477062508de7d672bf55bffec9e18.tar.gz tcl-ef86c6216a8477062508de7d672bf55bffec9e18.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 56acccf..6bc9204 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 c498162..1367730 100644 --- a/tests/chanio.test +++ b/tests/chanio.test @@ -6740,8 +6740,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 @@ -6756,8 +6756,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 @@ -6772,8 +6772,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 @@ -6788,8 +6788,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 @@ -6806,8 +6806,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 4073898..1b75e51 100644 --- a/tests/encoding.test +++ b/tests/encoding.test @@ -191,11 +191,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] @@ -219,11 +219,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 192322b..fe4a02b 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 -profile tcl8 + fconfigure $f1 -translation binary -buffering none -buffersize 4040 -profile tcl8 fconfigure $f1 } -cleanup { catch {close $f1} |