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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
1 ;;; -*- coding: iso-8859-1 -*-
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
2
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
3 ;; Copyright (C) 2000 Free Software Foundation, Inc.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
4
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
5 ;; Author: Yoshiki Hayashi <yoshiki@xemacs.org>
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
6 ;; Maintainer: Yoshiki Hayashi <yoshiki@xemacs.org>
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
7 ;; Created: 2000
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
8 ;; Keywords: tests
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
9
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
10 ;; This file is part of XEmacs.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
11
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
12 ;; XEmacs is free software; you can redistribute it and/or modify it
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
13 ;; under the terms of the GNU General Public License as published by
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
14 ;; the Free Software Foundation; either version 2, or (at your option)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
15 ;; any later version.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
16
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
17 ;; XEmacs is distributed in the hope that it will be useful, but
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
18 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
20 ;; General Public License for more details.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
21
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
22 ;; You should have received a copy of the GNU General Public License
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
23 ;; along with XEmacs; see the file COPYING. If not, write to the Free
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
24 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
25 ;; 02111-1307, USA.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
26
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
27 ;;; Synched up with: Not in FSF.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
28
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
29 ;;; Commentary:
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
30
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
31 ;; Test case-table related functionality.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
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
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
43 (Assert (case-table-p (standard-case-table)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
44 ;; Old case table test.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
45 (Assert (case-table-p (list
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
46 (make-string 256 ?a)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
47 nil nil nil)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
48 (Assert (case-table-p (list
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
49 (make-string 256 ?a)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
50 (make-string 256 ?b)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
51 nil nil)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
52 (Assert (case-table-p (list
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
53 (make-string 256 ?a)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
54 (make-string 256 ?b)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
55 (make-string 256 ?c)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
56 nil)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
57 (Assert (case-table-p (list
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
58 (make-string 256 ?a)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
59 (make-string 256 ?b)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
60 (make-string 256 ?c)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
61 (make-string 256 ?d))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
62 (Assert (not (case-table-p (list (make-string 256 ?a)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
63 (make-string 256 ?b)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
64 (make-string 256 ?c)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
65 (make-string 254 ?d)))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
66 (Assert (not (case-table-p (list (make-string 256 ?a)))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
67
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
68 (Assert (case-table-p (set-case-table (current-case-table))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
69
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
70 (defvar string-0-through-32
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
71 (let ((result (make-string 33 (int-to-char 0))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
72 (dotimes (i 33)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
73 (aset result i (int-to-char i)))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
74 result)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
75 "String containing characters from code point 0 (NUL) through 32 (SPC).")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
76
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
77 (defvar string-127-through-160
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
78 (let ((result (make-string 34 (int-to-char 0))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
79 (dotimes (i 34)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
80 (aset result i (int-to-char (+ 127 i))))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
81 result)
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
82 "String containing characters from code point 127 (DEL) through 160
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
83 \(no-break-space).")
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
84
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
85 ;; Case table sanity check.
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
86 (let ((downcase-string
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
87 (concat string-0-through-32
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
88 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
89 string-127-through-160
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
90 "¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
91 (upcase-string
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
92 (concat string-0-through-32
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
93 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
94 string-127-through-160
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
95 "¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ"))
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
96 (table (standard-case-table)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
97 (dotimes (i 256)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
98 (Assert (eq (get-case-table 'downcase (int-to-char i) table)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
99 (aref downcase-string i)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
100 (Assert (eq (get-case-table 'upcase (int-to-char i) table)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
101 (aref upcase-string i)))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
102
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
103 (Check-Error-Message error "Char case must be downcase or upcase"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
104 (get-case-table 'foo ?a (standard-case-table)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
105
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
106 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
107 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
108 (upcase "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
109 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
110
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
111 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
112 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
113 (upcase "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
114 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
115
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
116 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
117 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
118 (upcase " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
119 " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
120
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
121 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
122 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
123 (upcase " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
124 " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
125
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
126 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
127 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
128 (downcase "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
129 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
130
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
131 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
132 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
133 (downcase "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
134 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
135
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
136 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
137 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
138 (downcase " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
139 " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
140
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
141 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
142 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
143 (downcase " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ÷ØÙÚÛÜÝÞÿ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
144 " ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
145
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
146 ;; Old case table format test.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
147 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
148 (set-case-table
462
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
149 (list
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
150 (concat string-0-through-32
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
151 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
152 string-127-through-160
0784d089fdc9 Import from CVS: tag r21-2-46
cvs
parents: 446
diff changeset
153 "¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿àáâãäåæçèéêëìíîïðñòóôõö×øùúûüýþßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ")
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
154 nil nil nil))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
155 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
156 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
157 (upcase "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
158 "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
159 (Assert
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
160 (string=
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
161 (downcase "!\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
162 "!\"#$%&'()*+,-./0123456789:;<=>?@abcdefghijklmnopqrstuvwxyz")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
163
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
164 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
165 (insert "Test Buffer")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
166 (let ((case-fold-search t))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
167 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
168 (Assert (eq (search-forward "test buffer" nil t) 12))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
169 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
170 (Assert (eq (search-forward "Test buffer" nil t) 12))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
171 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
172 (Assert (eq (search-forward "Test Buffer" nil t) 12))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
173
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
174 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
175 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
176 (Assert (not (search-forward "test buffer" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
177 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
178 (Assert (not (search-forward "Test buffer" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
179 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
180 (Assert (eq (search-forward "Test Buffer" nil t) 12))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
181
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
182 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
183 (insert "abcdefghijklmnäopqrstuÄvwxyz")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
184 ;; case insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
185 (Assert (not (search-forward "ö" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
186 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
187 (Assert (eq 16 (search-forward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
188 (Assert (eq 24 (search-forward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
189 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
190 (Assert (eq 16 (search-forward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
191 (Assert (eq 24 (search-forward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
192 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
193 (Assert (eq 23 (search-backward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
194 (Assert (eq 15 (search-backward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
195 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
196 (Assert (eq 23 (search-backward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
197 (Assert (eq 15 (search-backward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
198 ;; case sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
199 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
200 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
201 (Assert (not (search-forward "ö" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
202 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
203 (Assert (eq 16 (search-forward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
204 (Assert (not (search-forward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
205 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
206 (Assert (eq 24 (search-forward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
207 (goto-char 16)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
208 (Assert (eq 24 (search-forward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
209 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
210 (Assert (eq 15 (search-backward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
211 (goto-char 15)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
212 (Assert (not (search-backward "ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
213 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
214 (Assert (eq 23 (search-backward "Ä" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
215 (Assert (not (search-backward "Ä" nil t))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
216
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
217 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
218 (insert "aaaaäÄäÄäÄäÄäÄbbbb")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
219 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
220 (Assert (eq 15 (search-forward "ää" nil t 5)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
221 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
222 (Assert (not (search-forward "ää" nil t 6)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
223 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
224 (Assert (eq 5 (search-backward "ää" nil t 5)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
225 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
226 (Assert (not (search-backward "ää" nil t 6))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
227
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
228 (when (featurep 'mule)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
229 (let* ((hiragana-a (make-char 'japanese-jisx0208 36 34))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
230 (a-diaeresis ?ä)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
231 (case-table (copy-case-table (standard-case-table)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
232 (str-hiragana-a (char-to-string hiragana-a))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
233 (str-a-diaeresis (char-to-string a-diaeresis))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
234 (string (concat str-hiragana-a str-a-diaeresis)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
235 (put-case-table-pair hiragana-a a-diaeresis case-table)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
236 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
237 (set-case-table case-table)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
238 (insert hiragana-a "abcdefg" a-diaeresis)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
239 ;; forward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
240 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
241 (Assert (not (search-forward "ö" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
242 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
243 (Assert (eq 2 (search-forward str-hiragana-a nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
244 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
245 (Assert (eq 2 (search-forward str-a-diaeresis nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
246 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
247 (Assert (eq (point-max)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
248 (search-forward str-hiragana-a nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
249 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
250 (Assert (eq (point-max)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
251 (search-forward str-a-diaeresis nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
252 ;; backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
253 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
254 (Assert (not (search-backward "ö" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
255 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
256 (Assert (eq (1- (point-max)) (search-backward str-hiragana-a nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
257 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
258 (Assert (eq (1- (point-max)) (search-backward str-a-diaeresis nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
259 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
260 (Assert (eq 1 (search-backward str-hiragana-a nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
261 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
262 (Assert (eq 1 (search-backward str-a-diaeresis nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
263 (replace-match "a")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
264 (Assert (looking-at (format "abcdefg%c" a-diaeresis))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
265 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
266 (set-case-table case-table)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
267 (insert string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
268 (insert string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
269 (insert string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
270 (insert string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
271 (insert string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
272 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
273 (Assert (eq 11 (search-forward string nil t 5)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
274 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
275 (Assert (not (search-forward string nil t 6)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
276 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
277 (Assert (eq 1 (search-backward string nil t 5)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
278 (goto-char (point-max))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
279 (Assert (not (search-backward string nil t 6))))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
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