diff tests/automated/mule-tests.el @ 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 db2db229ee82
children 0f66906b6e37
line wrap: on
line diff
--- 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))