aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2019-07-29 01:45:36 +0300
committerJuri Linkov2019-07-29 01:45:36 +0300
commitbe16c204d6fba6c7cf2e2cb9fda5d7f6637f12f7 (patch)
treed23726f18cb1470be6cb8d5f86b16bbcfa990050
parentd69e1d7056155d7c14eac31b9303af5ac1549e35 (diff)
downloademacs-be16c204d6fba6c7cf2e2cb9fda5d7f6637f12f7.tar.gz
emacs-be16c204d6fba6c7cf2e2cb9fda5d7f6637f12f7.zip
Move some uncontroversial char-folding pairs from test data to default values
* 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)
-rw-r--r--lisp/char-fold.el21
-rw-r--r--test/lisp/char-fold-tests.el50
2 files changed, 45 insertions, 26 deletions
diff --git a/lisp/char-fold.el b/lisp/char-fold.el
index f379229e6c4..b05d37455b9 100644
--- a/lisp/char-fold.el
+++ b/lisp/char-fold.el
@@ -27,12 +27,20 @@
27 (defconst char-fold--default-include 27 (defconst char-fold--default-include
28 '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»") 28 '((?\" """ "“" "”" "”" "„" "⹂" "〞" "‟" "‟" "❞" "❝" "❠" "“" "„" "〝" "〟" "🙷" "🙶" "🙸" "«" "»")
29 (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›") 29 (?' "❟" "❛" "❜" "‘" "’" "‚" "‛" "‚" "󠀢" "❮" "❯" "‹" "›")
30 (?` "❛" "‘" "‛" "󠀢" "❮" "‹"))) 30 (?` "❛" "‘" "‛" "󠀢" "❮" "‹")
31 (defconst char-fold--default-exclude nil) 31 (?ß "ss") ;; de
32 (?ι "ΐ") ;; el for (?ΐ "ΐ") decomposition
33 (?υ "ΰ") ;; el for (?ΰ "ΰ") decomposition
34 ))
35 (defconst char-fold--default-exclude
36 '(
37 (?и "й") ;; ru
38 ))
32 (defconst char-fold--default-symmetric nil) 39 (defconst char-fold--default-symmetric nil)
33 (defconst char-fold--previous (list char-fold--default-include 40 (defvar char-fold--previous
34 char-fold--default-exclude 41 (list char-fold--default-include
35 char-fold--default-symmetric))) 42 char-fold--default-exclude
43 char-fold--default-symmetric)))
36 44
37 45
38(eval-and-compile 46(eval-and-compile
@@ -221,12 +229,13 @@ Exceptionally for the space character (32), ALIST is ignored.")
221 229
222 230
223(defun char-fold-update-table () 231(defun char-fold-update-table ()
232 "Update char-fold-table only when one of the options changes its value."
224 (let ((new (list (or (bound-and-true-p char-fold-include) 233 (let ((new (list (or (bound-and-true-p char-fold-include)
225 char-fold--default-include) 234 char-fold--default-include)
226 (or (bound-and-true-p char-fold-exclude) 235 (or (bound-and-true-p char-fold-exclude)
227 char-fold--default-exclude) 236 char-fold--default-exclude)
228 (or (bound-and-true-p char-fold-symmetric) 237 (or (bound-and-true-p char-fold-symmetric)
229 char-fold--default-symmetric)))) 238 char-fold--default-symmetric))))
230 (unless (equal char-fold--previous new) 239 (unless (equal char-fold--previous new)
231 (setq char-fold-table (char-fold-make-table) 240 (setq char-fold-table (char-fold-make-table)
232 char-fold--previous new)))) 241 char-fold--previous new))))
diff --git a/test/lisp/char-fold-tests.el b/test/lisp/char-fold-tests.el
index e519435ef05..0efbdcf988c 100644
--- a/test/lisp/char-fold-tests.el
+++ b/test/lisp/char-fold-tests.el
@@ -150,47 +150,57 @@
150(ert-deftest char-fold--test-without-customization () 150(ert-deftest char-fold--test-without-customization ()
151 (let* ((matches 151 (let* ((matches
152 '( 152 '(
153 ("'" "’")
153 ("e" "ℯ" "ḗ" "ë" "ë") 154 ("e" "ℯ" "ḗ" "ë" "ë")
154 ("ι" 155 ("ι"
155 "ί" ;; 1 level decomposition 156 "ί" ;; 1 level decomposition
156 "ί" ;; 2 level decomposition 157 "ί" ;; 2 level decomposition
157 ;; FIXME: 158 "ΐ" ;; 3 level decomposition
158 ;; "ΐ" ;; 3 level decomposition
159 ) 159 )
160 ("ß" "ss")
161 ))
162 (no-matches
163 '(
164 ("и" "й")
160 ))) 165 )))
161 (dolist (strings matches) 166 (dolist (strings matches)
162 (apply 'char-fold--test-match-exactly strings)))) 167 (apply 'char-fold--test-match-exactly strings))
168 (dolist (strings no-matches)
169 (apply 'char-fold--test-no-match-exactly strings))))
163 170
164(ert-deftest char-fold--test-with-customization () 171(ert-deftest char-fold--test-with-customization ()
165 :tags '(:expensive-test) 172 :tags '(:expensive-test)
173 ;; FIXME: move some language-specific settings to defaults
166 (let* ((char-fold-include 174 (let* ((char-fold-include
167 '( 175 (append char-fold-include
168 (?ß "ss") ;; de 176 '(
169 (?o "ø") ;; da no nb nn 177 (?o "ø") ;; da no nb nn
170 (?l "ł") ;; pl 178 (?l "ł") ;; pl
171 )) 179 (?æ "ae")
172 ;; FIXME: move language-specific settings to defaults 180 (?→ "->")
181 (?⇒ "=>")
182 )))
173 (char-fold-exclude 183 (char-fold-exclude
174 '( 184 (append char-fold-exclude
175 (?a "å") ;; sv da no nb nn 185 '(
176 (?a "") ;; sv fi et 186 (?a "") ;; da no nb nn sv
177 (?o "") ;; sv fi et 187 (?a "") ;; et fi sv
178 (?n "") ;; es 188 (?o "") ;; et fi sv
179 (?и "й") ;; ru 189 (?n "ñ") ;; es
180 )) 190 )))
181 (char-fold-symmetric t) 191 (char-fold-symmetric t)
182 (char-fold-table (char-fold-make-table)) 192 (char-fold-table (char-fold-make-table))
183 (matches 193 (matches
184 '( 194 '(
185 ("e" "ℯ" "ḗ" "ë" "ë") 195 ("e" "ℯ" "ḗ" "ë" "ë")
186 ("е" "ё" "ё") 196 ("е" "ё" "ё")
187 ("ι" "ί" "ί" 197 ("ι" "ί" "ί" "ΐ")
188 ;; FIXME: "ΐ"
189 )
190 ("ß" "ss") 198 ("ß" "ss")
191 ("o" "ø") 199 ("o" "ø")
192 ("l" "ł") 200 ("l" "ł")
193 201 ("æ" "ae")
202 ("→" "->")
203 ("⇒" "=>")
194 )) 204 ))
195 (no-matches 205 (no-matches
196 '( 206 '(