diff options
-rw-r--r-- | tests/string.test | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/tests/string.test b/tests/string.test index 8548c31..8bd2dfa 100644 --- a/tests/string.test +++ b/tests/string.test @@ -12,7 +12,7 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# RCS: @(#) $Id: string.test,v 1.36.2.6 2006/01/23 11:48:25 msofer Exp $ +# RCS: @(#) $Id: string.test,v 1.36.2.7 2006/01/23 12:11:15 msofer Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -1052,16 +1052,21 @@ test string-12.19 {string range, bytearray object} { test string-12.20 {string range, out of bounds indices} { string range \u00ff 0 1 } \u00ff -test string-12.21 {string range, unicode, bug 1410553} { - set buf {} - foreach ch "\x00 \x03 \x41" { - append buf $ch - if {$ch == "\x03"} { - string length $buf +test string-12.21 {string range, regenerates correct reps, bug 1410553} { + set bytes "\x00 \x03 \x41" + set rxBuffer {} + foreach ch $bytes { + append rxBuffer $ch + if {$ch eq "\x03"} { + string length $rxBuffer } } - expr {[string range $buf end-1 end] eq "\x03\x41"} -} 1 + set rxCRC [string range $rxBuffer end-1 end] + binary scan [join $bytes {}] "H*" input_hex + binary scan $rxBuffer "H*" rxBuffer_hex + binary scan $rxCRC "H*" rxCRC_hex + list $input_hex $rxBuffer_hex $rxCRC_hex +} {000341 000341 0341} test string-13.1 {string repeat} { list [catch {string repeat} msg] $msg |