summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-01 07:27:28 (GMT)
committerjan.nijtmans <nijtmans@users.sourceforge.net>2023-04-01 07:27:28 (GMT)
commit7d1613ac75f237ba9375c3cf93b2755f8f193402 (patch)
tree3f298a8af4b95422eaa6198d38602ff195d679d0
parent21c787abd0afa5749ea87aff6da4fff2cb8e30b0 (diff)
downloadtcl-7d1613ac75f237ba9375c3cf93b2755f8f193402.zip
tcl-7d1613ac75f237ba9375c3cf93b2755f8f193402.tar.gz
tcl-7d1613ac75f237ba9375c3cf93b2755f8f193402.tar.bz2
Improve tcltest package: Don't use 'scan' for printable characters, and don't print lf as \x0A any more (as in Tcl 8.6)
-rw-r--r--library/tcltest/tcltest.tcl13
1 files changed, 6 insertions, 7 deletions
diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl
index 278a4e0..6a161a3 100644
--- a/library/tcltest/tcltest.tcl
+++ b/library/tcltest/tcltest.tcl
@@ -1152,15 +1152,14 @@ proc tcltest::SafeFetch {n1 n2 op} {
proc tcltest::Asciify {s} {
set print ""
foreach c [split $s ""] {
- set i [scan $c %c]
- if {[string is print $c] && ($i <= 127)} {
+ if {[string is print $c] && (($c <= "\x7E") || ($c == "\n"))} {
append print $c
- } elseif {$i <= 0xFF} {
- append print \\x[format %02X $i]
- } elseif {$i <= 0xFFFF} {
- append print \\u[format %04X $i]
+ } elseif {$c <= "\xFF"} {
+ append print \\x[format %02X [scan $c %c]]
+ } elseif {$c <= "\xFFFF"} {
+ append print \\u[format %04X [scan $c %c]]
} else {
- append print \\U[format %08X $i]
+ append print \\U[format %08X [scan $c %c]]
}
}
return $print