Mercurial > hg > xemacs-beta
annotate tests/automated/case-tests.el @ 4423:1982c8c55632
Correct and extend the previous test, thank you Stephen.
2008-02-14 Aidan Kehoe <kehoea@parhasard.net>
* automated/case-tests.el (let):
Correct and extend the previous test, thank you Stephen.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Thu, 14 Feb 2008 22:40:17 +0100 |
parents | 69b803c646cd |
children | 189fb67ca31a |
rev | line source |
---|---|
446 | 1 ;;; -*- coding: iso-8859-1 -*- |
2 | |
3 ;; Copyright (C) 2000 Free Software Foundation, Inc. | |
4 | |
5 ;; Author: Yoshiki Hayashi <yoshiki@xemacs.org> | |
6 ;; Maintainer: Yoshiki Hayashi <yoshiki@xemacs.org> | |
7 ;; Created: 2000 | |
8 ;; Keywords: tests | |
9 | |
10 ;; This file is part of XEmacs. | |
11 | |
12 ;; XEmacs is free software; you can redistribute it and/or modify it | |
13 ;; under the terms of the GNU General Public License as published by | |
14 ;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;; any later version. | |
16 | |
17 ;; XEmacs is distributed in the hope that it will be useful, but | |
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
20 ;; General Public License for more details. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free | |
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | |
25 ;; 02111-1307, USA. | |
26 | |
27 ;;; Synched up with: Not in FSF. | |
28 | |
29 ;;; Commentary: | |
30 | |
31 ;; Test case-table related functionality. | |
32 | |
4415
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
33 (defvar pristine-case-table nil |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
34 "The standard case table, without manipulation from case-tests.el") |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
35 |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
36 (setq pristine-case-table (or |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
37 ;; This is the compiled run; we've retained |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
38 ;; it from the interpreted run. |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
39 pristine-case-table |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
40 ;; This is the interpreted run; set it. |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
41 (copy-case-table (standard-case-table)))) |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
42 |
446 | 43 (Assert (case-table-p (standard-case-table))) |
44 ;; Old case table test. | |
45 (Assert (case-table-p (list | |
46 (make-string 256 ?a) | |
47 nil nil nil))) | |
48 (Assert (case-table-p (list | |
49 (make-string 256 ?a) | |
50 (make-string 256 ?b) | |
51 nil nil))) | |
52 (Assert (case-table-p (list | |
53 (make-string 256 ?a) | |
54 (make-string 256 ?b) | |
55 (make-string 256 ?c) | |
56 nil))) | |
57 (Assert (case-table-p (list | |
58 (make-string 256 ?a) | |
59 (make-string 256 ?b) | |
60 (make-string 256 ?c) | |
61 (make-string 256 ?d)))) | |
62 (Assert (not (case-table-p (list (make-string 256 ?a) | |
63 (make-string 256 ?b) | |
64 (make-string 256 ?c) | |
65 (make-string 254 ?d))))) | |
66 (Assert (not (case-table-p (list (make-string 256 ?a))))) | |
67 | |
68 (Assert (case-table-p (set-case-table (current-case-table)))) | |
69 | |
462 | 70 (defvar string-0-through-32 |
71 (let ((result (make-string 33 (int-to-char 0)))) | |
72 (dotimes (i 33) | |
73 (aset result i (int-to-char i))) | |
74 result) | |
75 "String containing characters from code point 0 (NUL) through 32 (SPC).") | |
76 | |
77 (defvar string-127-through-160 | |
78 (let ((result (make-string 34 (int-to-char 0)))) | |
79 (dotimes (i 34) | |
80 (aset result i (int-to-char (+ 127 i)))) | |
81 result) | |
82 "String containing characters from code point 127 (DEL) through 160 | |
83 \(no-break-space).") | |
84 | |
446 | 85 ;; Case table sanity check. |
462 | 86 (let ((downcase-string |
87 (concat string-0-through-32 | |
88 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" | |
89 string-127-through-160 | |
90 "¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ")) | |
91 (upcase-string | |
92 (concat string-0-through-32 | |
93 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~" | |
94 string-127-through-160 | |
95 "¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ")) | |
96 (table (standard-case-table))) | |
446 | 97 (dotimes (i 256) |
98 (Assert (eq (get-case-table 'downcase (int-to-char i) table) | |
99 (aref downcase-string i))) | |
100 (Assert (eq (get-case-table 'upcase (int-to-char i) table) | |
101 (aref upcase-string i))))) | |
102 | |
103 (Check-Error-Message error "Char case must be downcase or upcase" | |
104 (get-case-table 'foo ?a (standard-case-table))) | |
105 | |
106 (Assert | |
107 (string= | |
108 (upcase "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz") | |
109 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |
110 | |
111 (Assert | |
112 (string= | |
113 (upcase "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
114 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |
115 | |
116 (Assert | |
117 (string= | |
118 (upcase " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ") | |
119 " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ")) | |
120 | |
121 (Assert | |
122 (string= | |
123 (upcase " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ") | |
124 " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ")) | |
125 | |
126 (Assert | |
127 (string= | |
128 (downcase "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz") | |
129 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz")) | |
130 | |
131 (Assert | |
132 (string= | |
133 (downcase "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
134 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz")) | |
135 | |
136 (Assert | |
137 (string= | |
138 (downcase " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ") | |
139 " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ")) | |
140 | |
141 (Assert | |
142 (string= | |
143 (downcase " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ") | |
144 " ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ")) | |
145 | |
146 ;; Old case table format test. | |
147 (with-temp-buffer | |
148 (set-case-table | |
462 | 149 (list |
150 (concat string-0-through-32 | |
151 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~" | |
152 string-127-through-160 | |
153 "¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ") | |
446 | 154 nil nil nil)) |
155 (Assert | |
156 (string= | |
157 (upcase "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz") | |
158 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ")) | |
159 (Assert | |
160 (string= | |
161 (downcase "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ") | |
162 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz"))) | |
163 | |
164 (with-temp-buffer | |
165 (insert "Test Buffer") | |
166 (let ((case-fold-search t)) | |
167 (goto-char (point-min)) | |
168 (Assert (eq (search-forward "test buffer" nil t) 12)) | |
169 (goto-char (point-min)) | |
170 (Assert (eq (search-forward "Test buffer" nil t) 12)) | |
171 (goto-char (point-min)) | |
172 (Assert (eq (search-forward "Test Buffer" nil t) 12)) | |
173 | |
174 (setq case-fold-search nil) | |
175 (goto-char (point-min)) | |
176 (Assert (not (search-forward "test buffer" nil t))) | |
177 (goto-char (point-min)) | |
178 (Assert (not (search-forward "Test buffer" nil t))) | |
179 (goto-char (point-min)) | |
180 (Assert (eq (search-forward "Test Buffer" nil t) 12)))) | |
181 | |
182 (with-temp-buffer | |
183 (insert "abcdefghijklmnäopqrstuÄvwxyz") | |
184 ;; case insensitive | |
185 (Assert (not (search-forward "ö" nil t))) | |
186 (goto-char (point-min)) | |
187 (Assert (eq 16 (search-forward "ä" nil t))) | |
188 (Assert (eq 24 (search-forward "ä" nil t))) | |
189 (goto-char (point-min)) | |
190 (Assert (eq 16 (search-forward "Ä" nil t))) | |
191 (Assert (eq 24 (search-forward "Ä" nil t))) | |
192 (goto-char (point-max)) | |
193 (Assert (eq 23 (search-backward "ä" nil t))) | |
194 (Assert (eq 15 (search-backward "ä" nil t))) | |
195 (goto-char (point-max)) | |
196 (Assert (eq 23 (search-backward "Ä" nil t))) | |
197 (Assert (eq 15 (search-backward "Ä" nil t))) | |
198 ;; case sensitive | |
199 (setq case-fold-search nil) | |
200 (goto-char (point-min)) | |
201 (Assert (not (search-forward "ö" nil t))) | |
202 (goto-char (point-min)) | |
203 (Assert (eq 16 (search-forward "ä" nil t))) | |
204 (Assert (not (search-forward "ä" nil t))) | |
205 (goto-char (point-min)) | |
206 (Assert (eq 24 (search-forward "Ä" nil t))) | |
207 (goto-char 16) | |
208 (Assert (eq 24 (search-forward "Ä" nil t))) | |
209 (goto-char (point-max)) | |
210 (Assert (eq 15 (search-backward "ä" nil t))) | |
211 (goto-char 15) | |
212 (Assert (not (search-backward "ä" nil t))) | |
213 (goto-char (point-max)) | |
214 (Assert (eq 23 (search-backward "Ä" nil t))) | |
215 (Assert (not (search-backward "Ä" nil t)))) | |
216 | |
217 (with-temp-buffer | |
218 (insert "aaaaäÄäÄäÄäÄäÄbbbb") | |
219 (goto-char (point-min)) | |
220 (Assert (eq 15 (search-forward "ää" nil t 5))) | |
221 (goto-char (point-min)) | |
222 (Assert (not (search-forward "ää" nil t 6))) | |
223 (goto-char (point-max)) | |
224 (Assert (eq 5 (search-backward "ää" nil t 5))) | |
225 (goto-char (point-max)) | |
226 (Assert (not (search-backward "ää" nil t 6)))) | |
227 | |
228 (when (featurep 'mule) | |
229 (let* ((hiragana-a (make-char 'japanese-jisx0208 36 34)) | |
230 (a-diaeresis ?ä) | |
231 (case-table (copy-case-table (standard-case-table))) | |
232 (str-hiragana-a (char-to-string hiragana-a)) | |
233 (str-a-diaeresis (char-to-string a-diaeresis)) | |
234 (string (concat str-hiragana-a str-a-diaeresis))) | |
235 (put-case-table-pair hiragana-a a-diaeresis case-table) | |
236 (with-temp-buffer | |
237 (set-case-table case-table) | |
238 (insert hiragana-a "abcdefg" a-diaeresis) | |
239 ;; forward | |
240 (goto-char (point-min)) | |
241 (Assert (not (search-forward "ö" nil t))) | |
242 (goto-char (point-min)) | |
243 (Assert (eq 2 (search-forward str-hiragana-a nil t))) | |
244 (goto-char (point-min)) | |
245 (Assert (eq 2 (search-forward str-a-diaeresis nil t))) | |
246 (goto-char (1+ (point-min))) | |
247 (Assert (eq (point-max) | |
248 (search-forward str-hiragana-a nil t))) | |
249 (goto-char (1+ (point-min))) | |
250 (Assert (eq (point-max) | |
251 (search-forward str-a-diaeresis nil t))) | |
252 ;; backward | |
253 (goto-char (point-max)) | |
254 (Assert (not (search-backward "ö" nil t))) | |
255 (goto-char (point-max)) | |
256 (Assert (eq (1- (point-max)) (search-backward str-hiragana-a nil t))) | |
257 (goto-char (point-max)) | |
258 (Assert (eq (1- (point-max)) (search-backward str-a-diaeresis nil t))) | |
259 (goto-char (1- (point-max))) | |
260 (Assert (eq 1 (search-backward str-hiragana-a nil t))) | |
261 (goto-char (1- (point-max))) | |
262 (Assert (eq 1 (search-backward str-a-diaeresis nil t))) | |
263 (replace-match "a") | |
264 (Assert (looking-at (format "abcdefg%c" a-diaeresis)))) | |
265 (with-temp-buffer | |
266 (set-case-table case-table) | |
267 (insert string) | |
268 (insert string) | |
269 (insert string) | |
270 (insert string) | |
271 (insert string) | |
272 (goto-char (point-min)) | |
273 (Assert (eq 11 (search-forward string nil t 5))) | |
274 (goto-char (point-min)) | |
275 (Assert (not (search-forward string nil t 6))) | |
276 (goto-char (point-max)) | |
277 (Assert (eq 1 (search-backward string nil t 5))) | |
278 (goto-char (point-max)) | |
279 (Assert (not (search-backward string nil t 6)))))) | |
280 | |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
281 ;; Bug reported in http://mid.gmane.org/y9lk5lu5orq.fsf@deinprogramm.de from |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
282 ;; Michael Sperber. Fixed 2008-01-29. |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
283 (with-string-as-buffer-contents "\n\nDer beruhmte deutsche Flei\xdf\n\n" |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
284 (goto-char (point-min)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
285 (Assert (search-forward "Flei\xdf"))) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
286 |
4421
69b803c646cd
Fail searches immediately if searching for non-representable characters.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4415
diff
changeset
|
287 (with-temp-buffer |
4423
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
288 (let ((target "M\xe9zard") |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
289 (debug-xemacs-searches 1)) |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
290 (Assert (not (search-forward target nil t))) |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
291 (insert target) |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
292 (goto-char (point-min)) |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
293 ;; #### search-algorithm-used is simple-search after the following, |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
294 ;; which shouldn't be necessary; it should be possible to use |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
295 ;; Boyer-Moore. |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
296 ;; |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
297 ;; But searches for ASCII strings in buffers with nothing above ?\xFF |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
298 ;; use Boyer Moore with the current implementation, which is the |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
299 ;; important thing for the Gnus use case. |
1982c8c55632
Correct and extend the previous test, thank you Stephen.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4421
diff
changeset
|
300 (Assert (= (1+ (length target)) (search-forward target nil t))))) |
4421
69b803c646cd
Fail searches immediately if searching for non-representable characters.
Aidan Kehoe <kehoea@parhasard.net>
parents:
4415
diff
changeset
|
301 |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
302 (Skip-Test-Unless |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
303 (boundp 'debug-xemacs-searches) ; normal when we have DEBUG_XEMACS |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
304 "not a DEBUG_XEMACS build" |
4415
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
305 "checks that the algorithm chosen by #'search-forward is relatively sane" |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
306 (let ((debug-xemacs-searches 1)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
307 (with-temp-buffer |
4415
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
308 (set-case-table pristine-case-table) |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
309 (insert "\n\nDer beruhmte deutsche Fleiss\n\n") |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
310 (goto-char (point-min)) |
4415
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
311 (Assert (search-forward "Fleiss")) |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
312 (delete-region (point-min) (point-max)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
313 (insert "\n\nDer beruhmte deutsche Flei\xdf\n\n") |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
314 (goto-char (point-min)) |
4415
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
315 (Assert (search-forward "Flei\xdf")) |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
316 (Assert (eq 'boyer-moore search-algorithm-used)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
317 (delete-region (point-min) (point-max)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
318 (when (featurep 'mule) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
319 (insert "\n\nDer beruhmte deutsche Flei\xdf\n\n") |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
320 (goto-char (point-min)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
321 (Assert |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
322 (search-forward (format "Fle%c\xdf" |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
323 (make-char 'latin-iso8859-9 #xfd)))) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
324 (Assert (eq 'boyer-moore search-algorithm-used)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
325 (insert (make-char 'latin-iso8859-9 #xfd)) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
326 (goto-char (point-min)) |
4415
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
327 (Assert (search-forward "Flei\xdf")) |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
328 (Assert (eq 'simple-search search-algorithm-used)) |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
329 (goto-char (point-min)) |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
330 (Assert (search-forward (format "Fle%c\xdf" |
bceb3e285ae7
case-tests.el: fix it on non-DEBUG_XEMACS; save standard-case-table, use it
Aidan Kehoe <kehoea@parhasard.net>
parents:
4414
diff
changeset
|
331 (make-char 'latin-iso8859-9 #xfd)))) |
4414
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
332 (Assert (eq 'simple-search search-algorithm-used)))))) |
df576f30c1d8
Correct case-insensitive search for non-case, non-ASCII chars. Add tests.
Aidan Kehoe <kehoea@parhasard.net>
parents:
462
diff
changeset
|
333 |