]> git.eshelyaron.com Git - emacs.git/commitdiff
Move some uncontroversial char-folding pairs from test data to default values
authorJuri Linkov <juri@linkov.net>
Sun, 28 Jul 2019 22:45:36 +0000 (01:45 +0300)
committerJuri Linkov <juri@linkov.net>
Sun, 28 Jul 2019 22:45:36 +0000 (01:45 +0300)
* lisp/char-fold.el (char-fold--default-include)
(char-fold--default-exclude): Add some default values.

* test/lisp/char-fold-tests.el (char-fold--test-without-customization)
(char-fold--test-with-customization): Move some test data to
default values.  Add more data for tests to pass.   (Bug#35689)

lisp/char-fold.el
test/lisp/char-fold-tests.el

index f379229e6c4ac14a07e439b654fafd0468e26abe..b05d37455b9b11681fe37ae97462b42495bf9a1b 100644 (file)
   (defconst char-fold--default-include
     '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»")
       (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›")
-      (?` "❛" "‘" "‛" "󠀢" "❮" "‹")))
-  (defconst char-fold--default-exclude nil)
+      (?` "❛" "‘" "‛" "󠀢" "❮" "‹")
+      (?ß "ss") ;; de
+      (?ι "ΐ")  ;; el for (?ΐ "ΐ") decomposition
+      (?υ "ΰ")  ;; el for (?ΰ "ΰ") decomposition
+      ))
+  (defconst char-fold--default-exclude
+    '(
+      (?и "й")  ;; ru
+      ))
   (defconst char-fold--default-symmetric nil)
-  (defconst char-fold--previous (list char-fold--default-include
-                                      char-fold--default-exclude
-                                      char-fold--default-symmetric)))
+  (defvar char-fold--previous
+    (list char-fold--default-include
+          char-fold--default-exclude
+          char-fold--default-symmetric)))
 
 \f
 (eval-and-compile
@@ -221,12 +229,13 @@ Exceptionally for the space character (32), ALIST is ignored.")
 
 \f
 (defun char-fold-update-table ()
+  "Update char-fold-table only when one of the options changes its value."
   (let ((new (list (or (bound-and-true-p char-fold-include)
                        char-fold--default-include)
                    (or (bound-and-true-p char-fold-exclude)
                        char-fold--default-exclude)
                    (or (bound-and-true-p char-fold-symmetric)
-                      char-fold--default-symmetric))))
+                       char-fold--default-symmetric))))
     (unless (equal char-fold--previous new)
       (setq char-fold-table (char-fold-make-table)
             char-fold--previous new))))
index e519435ef05df493546fab262b2440345f76fcca..0efbdcf988c4062f88259cea26f5b2610e22a170 100644 (file)
 (ert-deftest char-fold--test-without-customization ()
   (let* ((matches
           '(
+            ("'" "’")
             ("e" "ℯ" "ḗ" "ë" "ë")
             ("ι"
              "ί" ;; 1 level decomposition
              "ί" ;; 2 level decomposition
-             ;; FIXME:
-             ;; "ΐ" ;; 3 level decomposition
+             "ΐ" ;; 3 level decomposition
              )
+            ("ß" "ss")
+            ))
+         (no-matches
+          '(
+            ("и" "й")
             )))
     (dolist (strings matches)
-      (apply 'char-fold--test-match-exactly strings))))
+      (apply 'char-fold--test-match-exactly strings))
+    (dolist (strings no-matches)
+      (apply 'char-fold--test-no-match-exactly strings))))
 
 (ert-deftest char-fold--test-with-customization ()
   :tags '(:expensive-test)
+  ;; FIXME: move some language-specific settings to defaults
   (let* ((char-fold-include
-          '(
-            (?ß "ss") ;; de
-            (?o "ø")  ;; da no nb nn
-            (?l "ł")  ;; pl
-            ))
-         ;; FIXME: move language-specific settings to defaults
+          (append char-fold-include
+                  '(
+                    (?o "ø") ;; da no nb nn
+                    (?l "ł") ;; pl
+                    (?æ "ae")
+                    (?→ "->")
+                    (?⇒ "=>")
+                    )))
          (char-fold-exclude
-          '(
-            (?a "å") ;; sv da no nb nn
-            (?a "ä") ;; sv fi et
-            (?o "ö") ;; sv fi et
-            (?n "ñ") ;; es
-            (?и "й") ;; ru
-            ))
+          (append char-fold-exclude
+                  '(
+                    (?a "å") ;; da no nb nn sv
+                    (?a "ä") ;; et fi sv
+                    (?o "ö") ;; et fi sv
+                    (?n "ñ") ;; es
+                    )))
          (char-fold-symmetric t)
          (char-fold-table (char-fold-make-table))
          (matches
           '(
             ("e" "ℯ" "ḗ" "ë" "ë")
             ("е" "ё" "ё")
-            ("ι" "ί" "ί"
-             ;; FIXME: "ΐ"
-             )
+            ("ι" "ί" "ί" "ΐ")
             ("ß" "ss")
             ("o" "ø")
             ("l" "ł")
-
+            ("æ" "ae")
+            ("→" "->")
+            ("⇒" "=>")
             ))
          (no-matches
           '(