summaryrefslogtreecommitdiffstats
path: root/tests/encoding.test
diff options
context:
space:
mode:
authorrmax <rmax>2004-05-07 20:01:11 (GMT)
committerrmax <rmax>2004-05-07 20:01:11 (GMT)
commitf5a61ae224e332ced24b7ff2fa575472e0ee7efd (patch)
tree000fc6f76b9004c2103a75d8adefa0369fdb579d /tests/encoding.test
parent8c5df5fda90a29c593793d69237f1f8cceb0e4c0 (diff)
downloadtcl-f5a61ae224e332ced24b7ff2fa575472e0ee7efd.zip
tcl-f5a61ae224e332ced24b7ff2fa575472e0ee7efd.tar.gz
tcl-f5a61ae224e332ced24b7ff2fa575472e0ee7efd.tar.bz2
* generic/tclEncoding.c:
* tests/encoding.test: added support and tests for translating embedded null characters between real nullbytes and the internal representation on input/output (Bug #949905).
Diffstat (limited to 'tests/encoding.test')
-rw-r--r--tests/encoding.test17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/encoding.test b/tests/encoding.test
index b955238..97ae787 100644
--- a/tests/encoding.test
+++ b/tests/encoding.test
@@ -8,7 +8,7 @@
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
-# RCS: @(#) $Id: encoding.test,v 1.19 2003/11/14 20:44:46 dgp Exp $
+# RCS: @(#) $Id: encoding.test,v 1.20 2004/05/07 20:01:23 rmax Exp $
package require tcltest 2
namespace import -force ::tcltest::*
@@ -291,6 +291,21 @@ test encoding-15.1 {UtfToUtfProc} {
encoding convertto utf-8 \xa3
} "\xc2\xa3"
+test encoding-15.2 {UtfToUtfProc null character output} {
+ set x \u0000
+ set y [encoding convertto utf-8 \u0000]
+ set y [encoding convertfrom identity $y]
+ binary scan $y H* z
+ list [string bytelength $x] [string bytelength $y] $z
+} {2 1 00}
+
+test encoding-15.3 {UtfToUtfProc null character input} {
+ set x [encoding convertfrom identity \x00]
+ set y [encoding convertfrom utf-8 $x]
+ binary scan [encoding convertto identity $y] H* z
+ list [string bytelength $x] [string bytelength $y] $z
+} {1 2 c080}
+
test encoding-16.1 {UnicodeToUtfProc} {
encoding convertfrom unicode NN
} "\u4e4e"