changeset 5107:ae4ddcdf30c0

Test escape-quoted for the range U+0000 to U+00FF. * automated/mule-tests.el (string character conversion): Inspired by Ben's patch to fix quoting of specials from C1 controls.
author Stephen J. Turnbull <stephen@xemacs.org>
date Sun, 07 Mar 2010 00:32:18 +0900
parents d76a51b29d91
children a50bd2ecce55
files tests/ChangeLog tests/automated/mule-tests.el
diffstat 2 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/tests/ChangeLog	Sat Mar 06 00:01:04 2010 -0600
+++ b/tests/ChangeLog	Sun Mar 07 00:32:18 2010 +0900
@@ -1,3 +1,9 @@
+2010-03-07  Stephen J. Turnbull  <stephen@xemacs.org>
+
+	* automated/mule-tests.el (string character conversion):
+	Test escape-quoted for the range U+0000 to U+00FF.
+	Inspired by Ben's patch to fix quoting of specials from C1 controls.
+
 2010-02-22  Ben Wing  <ben@xemacs.org>
 
 	* automated/syntax-tests.el:
--- a/tests/automated/mule-tests.el	Sat Mar 06 00:01:04 2010 -0600
+++ b/tests/automated/mule-tests.el	Sun Mar 07 00:32:18 2010 +0900
@@ -375,6 +375,29 @@
       (Assert-equal (substring string (* 94 k) (* 94 (1+ k))) ascii-string)))
 
   ;;---------------------------------------------------------------
+  ;; Test string character conversion
+  ;;---------------------------------------------------------------
+
+  ;; #### This should test all coding systems!
+
+  (let ((all-octets (let ((s (make-string 256 ?\000)))
+		      (loop for i from (1- (length s)) downto 0 do
+			(aset s i (int-char i)))
+		      s))
+	(escape-quoted-result (let ((schar '(27 155 142 143 14 15))
+				    (s (make-string 262 ?\000))
+				    (pos 0))
+				(loop for ord from 0 to 255 do
+				  (when (member ord schar)
+				    (aset s pos ?\033)
+				    (incf pos))
+				  (aset s pos (int-char ord))
+				  (incf pos))
+				s)))
+    (Assert (string= (encode-coding-string all-octets 'escape-quoted)
+		     escape-quoted-result)))
+
+  ;;---------------------------------------------------------------
   ;; Test file-system character conversion (and, en passant, file ops)
   ;;---------------------------------------------------------------
   (let* ((dstroke (make-char 'latin-iso8859-2 80))