fix CHAR-EQUALity of non-ascii caseful characters
authorChristophe Rhodes <csr21@cantab.net>
Mon, 27 May 2013 07:11:05 +0000 (08:11 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Mon, 27 May 2013 07:11:05 +0000 (08:11 +0100)
Or at least mostly fix it.  There are issues surrounding iota subscript and
titlecase, which aren't regressions in the current release and will require
some more investigation to fix.

src/code/target-char.lisp
tests/character.pure.lisp

index 395a894..e217f8e 100644 (file)
@@ -513,7 +513,7 @@ is either numeric or alphabetic."
 (defmacro equal-char-code (character)
   (let ((ch (gensym)))
     `(let ((,ch ,character))
-      (if (= (ucd-value-0 ,ch) 0)
+      (if (< (ucd-value-0 ,ch) 4)
           (ucd-value-1 ,ch)
           (char-code ,ch)))))
 
index 95c5833..c84b463 100644 (file)
                                            ((1 . ,(1- char-code-limit))))
                                           &optional))
                    (sb-impl::%fun-type f)))))
+
+(with-test (:name (:case-insensitive-char-comparisons :eacute))
+  (assert (char-equal (code-char 201) (code-char 233))))
+
+(with-test (:name (:case-insensitive-char-comparisons :exhaustive)
+            :fails-on '(and))
+  (dotimes (i char-code-limit)
+    (let* ((char (code-char i))
+           (down (char-downcase char))
+           (up (char-upcase char)))
+      (assert (char-equal char char))
+      (when (char/= char down)
+        (assert (char-equal char down)))
+      (when (char/= char up)
+        (assert (char-equal char up))))))