Mercurial > hg > xemacs-beta
comparison tests/automated/case-tests.el @ 4453:29efd169efe7
Automated merge with file:/Sources/xemacs-21.5-checked-out
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Sun, 11 May 2008 11:24:01 +0200 |
parents | 1982c8c55632 |
children | 189fb67ca31a |
comparison
equal
deleted
inserted
replaced
4452:82f8351e71c8 | 4453:29efd169efe7 |
---|---|
27 ;;; Synched up with: Not in FSF. | 27 ;;; Synched up with: Not in FSF. |
28 | 28 |
29 ;;; Commentary: | 29 ;;; Commentary: |
30 | 30 |
31 ;; Test case-table related functionality. | 31 ;; Test case-table related functionality. |
32 | |
33 (defvar pristine-case-table nil | |
34 "The standard case table, without manipulation from case-tests.el") | |
35 | |
36 (setq pristine-case-table (or | |
37 ;; This is the compiled run; we've retained | |
38 ;; it from the interpreted run. | |
39 pristine-case-table | |
40 ;; This is the interpreted run; set it. | |
41 (copy-case-table (standard-case-table)))) | |
32 | 42 |
33 (Assert (case-table-p (standard-case-table))) | 43 (Assert (case-table-p (standard-case-table))) |
34 ;; Old case table test. | 44 ;; Old case table test. |
35 (Assert (case-table-p (list | 45 (Assert (case-table-p (list |
36 (make-string 256 ?a) | 46 (make-string 256 ?a) |
266 (goto-char (point-max)) | 276 (goto-char (point-max)) |
267 (Assert (eq 1 (search-backward string nil t 5))) | 277 (Assert (eq 1 (search-backward string nil t 5))) |
268 (goto-char (point-max)) | 278 (goto-char (point-max)) |
269 (Assert (not (search-backward string nil t 6)))))) | 279 (Assert (not (search-backward string nil t 6)))))) |
270 | 280 |
281 ;; Bug reported in http://mid.gmane.org/y9lk5lu5orq.fsf@deinprogramm.de from | |
282 ;; Michael Sperber. Fixed 2008-01-29. | |
283 (with-string-as-buffer-contents "\n\nDer beruhmte deutsche Flei\xdf\n\n" | |
284 (goto-char (point-min)) | |
285 (Assert (search-forward "Flei\xdf"))) | |
286 | |
287 (with-temp-buffer | |
288 (let ((target "M\xe9zard") | |
289 (debug-xemacs-searches 1)) | |
290 (Assert (not (search-forward target nil t))) | |
291 (insert target) | |
292 (goto-char (point-min)) | |
293 ;; #### search-algorithm-used is simple-search after the following, | |
294 ;; which shouldn't be necessary; it should be possible to use | |
295 ;; Boyer-Moore. | |
296 ;; | |
297 ;; But searches for ASCII strings in buffers with nothing above ?\xFF | |
298 ;; use Boyer Moore with the current implementation, which is the | |
299 ;; important thing for the Gnus use case. | |
300 (Assert (= (1+ (length target)) (search-forward target nil t))))) | |
301 | |
302 (Skip-Test-Unless | |
303 (boundp 'debug-xemacs-searches) ; normal when we have DEBUG_XEMACS | |
304 "not a DEBUG_XEMACS build" | |
305 "checks that the algorithm chosen by #'search-forward is relatively sane" | |
306 (let ((debug-xemacs-searches 1)) | |
307 (with-temp-buffer | |
308 (set-case-table pristine-case-table) | |
309 (insert "\n\nDer beruhmte deutsche Fleiss\n\n") | |
310 (goto-char (point-min)) | |
311 (Assert (search-forward "Fleiss")) | |
312 (delete-region (point-min) (point-max)) | |
313 (insert "\n\nDer beruhmte deutsche Flei\xdf\n\n") | |
314 (goto-char (point-min)) | |
315 (Assert (search-forward "Flei\xdf")) | |
316 (Assert (eq 'boyer-moore search-algorithm-used)) | |
317 (delete-region (point-min) (point-max)) | |
318 (when (featurep 'mule) | |
319 (insert "\n\nDer beruhmte deutsche Flei\xdf\n\n") | |
320 (goto-char (point-min)) | |
321 (Assert | |
322 (search-forward (format "Fle%c\xdf" | |
323 (make-char 'latin-iso8859-9 #xfd)))) | |
324 (Assert (eq 'boyer-moore search-algorithm-used)) | |
325 (insert (make-char 'latin-iso8859-9 #xfd)) | |
326 (goto-char (point-min)) | |
327 (Assert (search-forward "Flei\xdf")) | |
328 (Assert (eq 'simple-search search-algorithm-used)) | |
329 (goto-char (point-min)) | |
330 (Assert (search-forward (format "Fle%c\xdf" | |
331 (make-char 'latin-iso8859-9 #xfd)))) | |
332 (Assert (eq 'simple-search search-algorithm-used)))))) | |
333 |