diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-12-01 15:15:28 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-12-01 15:15:28 (GMT) |
commit | 5878b9510bf288f9e34e2bc65799101b209fec06 (patch) | |
tree | a5624132af562f3a5adf10a8346f9f9fd5a2fc55 /library/tcltest | |
parent | 3ae4ed89d048fa82b852ea788b27088e72892efd (diff) | |
download | tcl-5878b9510bf288f9e34e2bc65799101b209fec06.zip tcl-5878b9510bf288f9e34e2bc65799101b209fec06.tar.gz tcl-5878b9510bf288f9e34e2bc65799101b209fec06.tar.bz2 |
Fix 2 testcases in Windows. Cause: tcltest::makeFile should assume the same encoding as the "source" command uses (TIP #589)
Aso remove the ::tcltest::bytestring command: It doesn't work any more starting Tcl 8.7 since the "identity" encoding is gone (TIP #345)
Diffstat (limited to 'library/tcltest')
-rw-r--r-- | library/tcltest/tcltest.tcl | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 285a33d..32500c8 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -41,7 +41,9 @@ namespace eval tcltest { outputChannel testConstraint # Export commands that are duplication (candidates for deprecation) - namespace export bytestring ;# dups [encoding convertfrom identity] + if {![package vsatisfies [package provide Tcl] 8.7-]} { + namespace export bytestring ;# dups [encoding convertfrom identity] + } namespace export debug ;# [configure -debug] namespace export errorFile ;# [configure -errfile] namespace export limitConstraints ;# [configure -limitconstraints] @@ -3080,6 +3082,9 @@ proc tcltest::makeFile {contents name {directory ""}} { set fd [open $fullName w] chan configure $fd -translation lf + if {[package vsatisfies [package provide Tcl] 8.7-]} { + chan configure $fd -encoding utf-8 + } if {[string index $contents end] eq "\n"} { puts -nonewline $fd $contents } else { @@ -3249,6 +3254,9 @@ proc tcltest::viewFile {name {directory ""}} { # construct improperly formed strings in this manner, because it involves # exposing that Tcl uses UTF-8 internally. # +# This function doesn't work any more in Tcl 8.7, since the 'identity' +# is gone (TIP #345) +# # Arguments: # string being converted # @@ -3258,8 +3266,10 @@ proc tcltest::viewFile {name {directory ""}} { # Side effects: # None -proc tcltest::bytestring {string} { - return [encoding convertfrom identity $string] +if {![package vsatisfies [package provide Tcl] 8.7-]} { + proc tcltest::bytestring {string} { + return [encoding convertfrom identity $string] + } } # tcltest::OpenFiles -- |