summaryrefslogtreecommitdiffstats
path: root/library/tcltest
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2020-12-01 15:28:03 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2020-12-01 15:28:03 (GMT)
commit7c3b884ac2d10d1ca50e15b96506b6eda5e04442 (patch)
tree5f03af02ec7ae33e98fe619be4e010946ae10d17 /library/tcltest
parent5878b9510bf288f9e34e2bc65799101b209fec06 (diff)
downloadtcl-7c3b884ac2d10d1ca50e15b96506b6eda5e04442.zip
tcl-7c3b884ac2d10d1ca50e15b96506b6eda5e04442.tar.gz
tcl-7c3b884ac2d10d1ca50e15b96506b6eda5e04442.tar.bz2
Another TIP #589 side-effect: Make sure that the encoding used in ::tcltest::viewFile matches the one in ::tcltest::makeFile
Diffstat (limited to 'library/tcltest')
-rw-r--r--library/tcltest/tcltest.tcl9
1 files changed, 6 insertions, 3 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index 32500c8..33ad322 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -1271,7 +1271,7 @@ proc tcltest::DefineConstraintInitializers {} {
ConstraintInitializer nonBlockFiles {
set code [expr {[catch {set f [open defs r]}]
- || [catch {chan configure $f -blocking off}]}]
+ || [catch {fconfigure $f -blocking off}]}]
catch {close $f}
set code
}
@@ -3081,9 +3081,9 @@ proc tcltest::makeFile {contents name {directory ""}} {
putting ``$contents'' into $fullName"
set fd [open $fullName w]
- chan configure $fd -translation lf
+ fconfigure $fd -translation lf
if {[package vsatisfies [package provide Tcl] 8.7-]} {
- chan configure $fd -encoding utf-8
+ fconfigure $fd -encoding utf-8
}
if {[string index $contents end] eq "\n"} {
puts -nonewline $fd $contents
@@ -3233,6 +3233,9 @@ proc tcltest::viewFile {name {directory ""}} {
}
set fullName [file join $directory $name]
set f [open $fullName]
+ if {[package vsatisfies [package provide Tcl] 8.7-]} {
+ fconfigure $f -encoding utf-8
+ }
set data [read -nonewline $f]
close $f
return $data