annotate tests/automated/regexp-tests.el @ 5912:47ffa085a9ad

Fix a bug when passing a float to truncate and giving a bignum result. src/ChangeLog addition: 2015-05-10 Aidan Kehoe <kehoea@parhasard.net> * floatfns.c (truncate_one_float): Fix a bug here when double_to_integer() (and previously float_to_int()) returned a bignum; this was silently treated as a fixnum, giving consistently incorrect remainders and less consistently-incorrect but still buggy divisors. tests/ChangeLog addition: Check that a bug when supplying #'truncate with one float that rounds to a bignum, has been fixed.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 10 May 2015 23:55:41 +0100
parents 8a2ac78cb97d
children
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
1612
28ffd53a1d42 [xemacs-hg @ 2003-08-11 10:03:34 by stephent]
stephent
parents: 1472
diff changeset
3 ;; Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
4 ;; Copyright (C) 2010 Ben Wing.
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
5
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
6 ;; Author: Yoshiki Hayashi <yoshiki@xemacs.org>
1612
28ffd53a1d42 [xemacs-hg @ 2003-08-11 10:03:34 by stephent]
stephent
parents: 1472
diff changeset
7 ;; Maintainer: Stephen J. Turnbull <stephen@xemacs.org>
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
8 ;; Created: 2000
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
9 ;; Keywords: tests
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
10
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
11 ;; This file is part of XEmacs.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
12
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
13 ;; XEmacs is free software: you can redistribute it and/or modify it
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
14 ;; under the terms of the GNU General Public License as published by the
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
15 ;; Free Software Foundation, either version 3 of the License, or (at your
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
16 ;; option) any later version.
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
17
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
18 ;; XEmacs is distributed in the hope that it will be useful, but WITHOUT
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
19 ;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
20 ;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
21 ;; for more details.
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
22
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
5402
308d34e9f07d Changed bulk of GPLv2 or later files identified by script
Mats Lidell <matsl@xemacs.org>
parents: 5136
diff changeset
24 ;; along with XEmacs. If not, see <http://www.gnu.org/licenses/>.
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
25
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
26 ;;; Synched up with: Not in FSF.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
27
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
28 ;;; Commentary:
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
29
4897
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
30 ;; Test regular expressions.
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
31
4906
6ef8256a020a implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents: 4900
diff changeset
32 ;; NOTE NOTE NOTE: There is some domain overlap among case-tests.el,
6ef8256a020a implement equalp in C, fix case-folding, add equal() method for keymaps
Ben Wing <ben@xemacs.org>
parents: 4900
diff changeset
33 ;; regexp-tests.el and search-tests.el. See case-tests.el.
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
34
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
35 (Check-Error-Message error "Trailing backslash"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
36 (string-match "\\" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
37 (Check-Error-Message error "Invalid preceding regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
38 (string-match "a++" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
39 (Check-Error-Message error "Invalid preceding regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
40 (string-match "a**" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
41 (Check-Error-Message error "Invalid preceding regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
42 (string-match "a???" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
43 (Check-Error-Message error "Unmatched \\[ or \\[^"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
44 (string-match "[" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
45 (Check-Error-Message error "Unmatched \\[ or \\[^"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
46 (string-match "[abc" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
47 (Check-Error-Message error "Unmatched ) or \\\\)"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
48 (string-match "\\)" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
49 (Check-Error-Message error "Invalid regular expression"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
50 (string-match "\\(?.\\)" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
51 (Check-Error-Message error "Unmatched \\\\{"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
52 (string-match "a\\{" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
53 (Check-Error-Message error "Invalid content of \\\\{\\\\}"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
54 (string-match "a\\{a\\}" "a"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
55
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
56 ;; exactn
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
57
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
58 ;; string-match
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
59 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
60 ;; case-insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
61 (Assert (string-match "ä" "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
62 (Assert (string-match "ä" "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
63 (Assert (string-match "Ä" "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
64 (Assert (string-match "Ä" "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
65 ;; case-sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
66 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
67 (Assert (string-match "ä" "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
68 (Assert (not (string-match "ä" "Ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
69 (Assert (string-match "Ä" "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
70 (Assert (not (string-match "Ä" "ä"))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
71
5649
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
72 ;; Is posix-string-match passing the POSIX flag correctly?
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
73
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
74 (Assert
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
75 (equal
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
76 (save-match-data
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
77 (progn (posix-string-match "i\\|ii" "ii") (match-data)))
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
78 '(0 2))
5653
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
79 "checking #'posix-string-match actually returns the longest match")
5649
d026b665014f Actually obey POSIX rules in #'posix-string-match, don't ignore them.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5648
diff changeset
80
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
81 ;; looking-at
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
82 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
83 (insert "äÄ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
84 ;; case-insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
85 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
86 (Assert (looking-at "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
87 (Assert (looking-at "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
88 (forward-char)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
89 (Assert (looking-at "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
90 (Assert (looking-at "Ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
91 ;; case-sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
92 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
93 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
94 (Assert (looking-at "ä"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
95 (Assert (not (looking-at "Ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
96 (forward-char)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
97 (Assert (not (looking-at "ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
98 (Assert (looking-at "Ä")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
99
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
100 ;; re-search-forward and re-search-backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
101 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
102 (insert "äÄ")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
103 ;; case insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
104 ;; forward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
105 (goto-char (point-min))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
106 ;; Avoid trivial regexp.
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
107 (Assert (eq 2 (re-search-forward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
108 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
109 (Assert (eq 2 (re-search-forward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
110 (goto-char (1+ (point-min)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
111 (Assert (eq 3 (re-search-forward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
112 (goto-char (1+ (point-min)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
113 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
114 ;; backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
115 (goto-char (point-max))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
116 (Assert (eq 2 (re-search-backward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
117 (goto-char (point-max))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
118 (Assert (eq 2 (re-search-backward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
119 (goto-char (1- (point-max)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
120 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
121 (goto-char (1- (point-max)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
122 (Assert (eq 1 (re-search-backward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
123 ;; case sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
124 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
125 ;; forward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
126 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
127 (Assert (eq 2 (re-search-forward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
128 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
129 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
130 (goto-char (1+ (point-min)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
131 (Assert (not (re-search-forward "ä\\|a" nil t)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
132 (goto-char (1+ (point-min)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
133 (Assert (eq 3 (re-search-forward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
134 ;; backward
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
135 (goto-char (point-max))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
136 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
137 (goto-char (point-max))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
138 (Assert (eq 2 (re-search-backward "Ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
139 (goto-char (1- (point-max)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
140 (Assert (eq 1 (re-search-backward "ä\\|a" nil t)))
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
141 (goto-char (1- (point-max)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
142 (Assert (not (re-search-backward "Ä\\|a" nil t))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
143
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
144 ;; duplicate
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
145 (with-temp-buffer
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
146 ;; case insensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
147 (Assert (string-match "^\\(ä\\)\\1$" "ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
148 (Assert (string-match "^\\(ä\\)\\1$" "äÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
149 (Assert (string-match "^\\(ä\\)\\1$" "ÄÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
150 (Assert (string-match "^\\(ä\\)\\1$" "Ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
151 (Assert (string-match "^\\(Ä\\)\\1$" "ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
152 (Assert (string-match "^\\(Ä\\)\\1$" "äÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
153 (Assert (string-match "^\\(Ä\\)\\1$" "ÄÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
154 (Assert (string-match "^\\(Ä\\)\\1$" "Ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
155 ;; case sensitive
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
156 (setq case-fold-search nil)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
157 (Assert (string-match "^\\(ä\\)\\1$" "ää"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
158 (Assert (not (string-match "^\\(ä\\)\\1$" "äÄ")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
159 (Assert (not (string-match "^\\(ä\\)\\1$" "ÄÄ")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
160 (Assert (not (string-match "^\\(ä\\)\\1$" "Ää")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
161 (Assert (not (string-match "^\\(Ä\\)\\1$" "ää")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
162 (Assert (not (string-match "^\\(Ä\\)\\1$" "äÄ")))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
163 (Assert (string-match "^\\(Ä\\)\\1$" "ÄÄ"))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
164 (Assert (not (string-match "^\\(Ä\\)\\1$" "Ää"))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
165
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
166 ;; multiple-match
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
167 ;; Thanks to Manfred Bartz <MBartz@xix.com>
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
168 ;; c.e.x <vn4rkkm7ouf3b5@corp.supernews.com>
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
169 ;; #### Need to do repetitions of more complex regexps
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
170 ;; #### WASH ME!
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
171 (with-temp-buffer
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
172 (Assert (not (string-match "^a\\{4,4\\}$" "aaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
173 (Assert (string-match "^a\\{4,4\\}$" "aaaa"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
174 (Assert (not (string-match "^a\\{4,4\\}$" "aaaaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
175 (Assert (not (string-match "^[a]\\{4,4\\}$" "aaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
176 (Assert (string-match "^[a]\\{4,4\\}$" "aaaa"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
177 (Assert (not (string-match "^[a]\\{4,4\\}$" "aaaaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
178 (Assert (not (string-match "^\\(a\\)\\{4,4\\}$" "aaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
179 (Assert (string-match "^\\(a\\)\\{4,4\\}$" "aaaa"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
180 (Assert (not (string-match "^\\(a\\)\\{4,4\\}$" "aaaaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
181 ;; Use class because repetition of single char broken in 21.5.15
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
182 (Assert (not (string-match "^[a]\\{3,5\\}$" "aa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
183 (Assert (string-match "^[a]\\{3,5\\}$" "aaa"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
184 (Assert (string-match "^[a]\\{3,5\\}$" "aaaa"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
185 (Assert (string-match "^[a]\\{3,5\\}$" "aaaaa"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
186 (Assert (not (string-match "^[a]\\{3,5\\}$" "aaaaaa")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
187 (insert "\
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
188 aa
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
189 aaa
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
190 aaaa
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
191 aaaaa
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
192 aaaaaa
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
193 baaaa
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
194 ")
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
195 (goto-char (point-min))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
196 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
197 (Assert (not (looking-at "^a\\{4,4\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
198 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
199 (Assert (looking-at "^a\\{4,4\\}$"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
200 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
201 (Assert (not (looking-at "^a\\{4,4\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
202 (goto-char (point-min))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
203 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
204 (Assert (not (looking-at "^[a]\\{4,4\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
205 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
206 (Assert (looking-at "^[a]\\{4,4\\}$"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
207 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
208 (Assert (not (looking-at "^[a]\\{4,4\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
209 (goto-char (point-min))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
210 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
211 (Assert (not (looking-at "^\\(a\\)\\{4,4\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
212 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
213 (Assert (looking-at "^\\(a\\)\\{4,4\\}$"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
214 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
215 (Assert (not (looking-at "^\\(a\\)\\{4,4\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
216 ;; Use class because repetition of single char broken in 21.5.15
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
217 (goto-char (point-min))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
218 (Assert (not (looking-at "^[a]\\{3,5\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
219 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
220 (Assert (looking-at "^[a]\\{3,5\\}$"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
221 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
222 (Assert (looking-at "^[a]\\{3,5\\}$"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
223 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
224 (Assert (looking-at "^[a]\\{3,5\\}$"))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
225 (forward-line 1)
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
226 (Assert (not (looking-at "^[a]\\{3,5\\}$")))
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
227 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
228 (Assert (= 12 (re-search-forward "a\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
229 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
230 (Assert (= 12 (re-search-forward "b?a\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
231 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
232 (Assert (= 31 (re-search-forward "ba\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
233 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
234 (Assert (= 31 (re-search-forward "[b]a\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
235 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
236 (Assert (= 31 (re-search-forward "\\(b\\)a\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
237 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
238 (Assert (= 12 (re-search-forward "^a\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
239 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
240 (Assert (= 12 (re-search-forward "^a\\{4,4\\}$")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
241 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
242 (Assert (= 12 (re-search-forward "[a]\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
243 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
244 (Assert (= 12 (re-search-forward "^[a]\\{4,4\\}")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
245 (goto-char (point-min))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
246 (Assert (= 12 (re-search-forward "^[a]\\{4,4\\}$")))
1714
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
247 )
61179c12fbb7 [xemacs-hg @ 2003-09-25 11:59:20 by stephent]
stephent
parents: 1612
diff changeset
248
446
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
249 ;; charset, charset_not
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
250 ;; Not called because it takes too much time.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
251 (defun test-regexp-charset-paranoid ()
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
252 (let ((i 0)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
253 (max (expt 2 (if (featurep 'mule) 19 8)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
254 (range "[a-z]")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
255 (range-not "[^a-z]")
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
256 char string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
257 (while (< i max)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
258 (when (setq char (int-to-char i))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
259 (setq string (char-to-string char))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
260 (if (or (and (<= 65 i)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
261 (<= i 90))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
262 (and (<= 97 i)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
263 (<= i 122)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
264 (progn
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
265 (Assert (string-match range string))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
266 (Assert (not (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
267 (Assert (not (string-match range string)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
268 (Assert (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
269 (setq i (1+ i)))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
270
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
271 ;; (test-regexp-charset-paranoid)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
272
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
273 ;; charset_mule, charset_mule_not
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
274 ;; Not called because it takes too much time.
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
275 (defun test-regex-charset-mule-paranoid ()
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
276 (if (featurep 'mule)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
277 (let ((i 0)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
278 (max (expt 2 19))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
279 (range (format "[%c-%c]"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
280 (make-char 'japanese-jisx0208 36 34)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
281 (make-char 'japanese-jisx0208 36 42)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
282 (range-not (format "[^%c-%c]"
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
283 (make-char 'japanese-jisx0208 36 34)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
284 (make-char 'japanese-jisx0208 36 42)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
285 (min-int (char-to-int (make-char 'japanese-jisx0208 36 34)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
286 (max-int (char-to-int (make-char 'japanese-jisx0208 36 42)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
287 char string)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
288 (while (< i max)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
289 (when (setq char (int-to-char i))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
290 (setq string (char-to-string char))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
291 (if (and (<= min-int i)
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
292 (<= i max-int))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
293 (progn
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
294 (Assert (string-match range string))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
295 (Assert (not (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
296 (Assert (not (string-match range string)))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
297 (Assert (string-match range-not string))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
298 (setq i (1+ i))))))
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
299
1ccc32a20af4 Import from CVS: tag r21-2-38
cvs
parents:
diff changeset
300 ;; (test-regex-charset-mule-paranoid)
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
301
1472
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
302 ;; Test that replace-match does not clobber registers after a failed match
448
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
303 (with-temp-buffer
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
304 (insert "This is a test buffer.")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
305 (goto-char (point-min))
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
306 (search-forward "this is a test ")
3078fd1074e8 Import from CVS: tag r21-2-39
cvs
parents: 446
diff changeset
307 (looking-at "Unmatchable text")
1472
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
308 (replace-match "")
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
309 (Assert (looking-at "^buffer.$")))
1024
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
310
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
311 ;; Test that trivial regexps reset unused registers
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
312 ;; Thanks to Martin Sternholm for the report.
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
313 ;; xemacs-beta <5blm6h2ki5.fsf@lister.roxen.com>
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
314 (with-temp-buffer
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
315 (insert "ab")
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
316 (goto-char (point-min))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
317 (re-search-forward "\\(a\\)")
1175
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
318 ;; test the whole-match data, too -- one attempted fix scotched that, too!
1024
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
319 (Assert (string= (match-string 0) "a"))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
320 (Assert (string= (match-string 1) "a"))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
321 (re-search-forward "b")
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
322 (Assert (string= (match-string 0) "b"))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
323 (Assert (string= (match-string 1) nil)))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
324
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
325 ;; Test word boundaries
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
326 (Assert (= (string-match "\\<a" " a") 1))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
327 (Assert (= (string-match "a\\>" "a ") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
328 (Assert (= (string-match "\\ba" " a") 1))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
329 (Assert (= (string-match "a\\b" "a ") 0))
1024
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
330 ;; should work at target boundaries
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
331 (Assert (= (string-match "\\<a" "a") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
332 (Assert (= (string-match "a\\>" "a") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
333 (Assert (= (string-match "\\ba" "a") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
334 (Assert (= (string-match "a\\b" "a") 0))
1095
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
335 ;; Check for weirdness
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
336 (Assert (not (string-match " \\> " " ")))
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
337 (Assert (not (string-match " \\< " " ")))
0d33547d9ed3 [xemacs-hg @ 2002-11-11 15:39:03 by stephent]
stephent
parents: 1024
diff changeset
338 (Assert (not (string-match " \\b " " ")))
1024
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
339 ;; but not if the "word" would be on the null side of the boundary!
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
340 (Assert (not (string-match "\\<" "")))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
341 (Assert (not (string-match "\\>" "")))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
342 (Assert (not (string-match " \\<" " ")))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
343 (Assert (not (string-match "\\> " " ")))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
344 (Assert (not (string-match "a\\<" "a")))
ccaf90c5a53a [xemacs-hg @ 2002-10-02 09:29:37 by stephent]
stephent
parents: 448
diff changeset
345 (Assert (not (string-match "\\>a" "a")))
1389
6355bae896e3 [xemacs-hg @ 2003-03-27 12:57:36 by stephent]
stephent
parents: 1195
diff changeset
346 ;; Added Known-Bug 2002-09-09 sjt
6355bae896e3 [xemacs-hg @ 2003-03-27 12:57:36 by stephent]
stephent
parents: 1195
diff changeset
347 ;; Fixed bug 2003-03-21 sjt
6355bae896e3 [xemacs-hg @ 2003-03-27 12:57:36 by stephent]
stephent
parents: 1195
diff changeset
348 (Assert (not (string-match "\\b" "")))
6355bae896e3 [xemacs-hg @ 2003-03-27 12:57:36 by stephent]
stephent
parents: 1195
diff changeset
349 (Assert (not (string-match "\\b" " ")))
6355bae896e3 [xemacs-hg @ 2003-03-27 12:57:36 by stephent]
stephent
parents: 1195
diff changeset
350 (Assert (not (string-match " \\b" " ")))
6355bae896e3 [xemacs-hg @ 2003-03-27 12:57:36 by stephent]
stephent
parents: 1195
diff changeset
351 (Assert (not (string-match "\\b " " ")))
1175
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
352
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
353 ;; Character classes are broken in Mule as of 21.5.9
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
354 ;; Added Known-Bug 2002-12-27
1413
aa15a2bbba1a [xemacs-hg @ 2003-04-15 15:56:56 by stephent]
stephent
parents: 1389
diff changeset
355 ;; Fixed by Daiki Ueno 2003-03-24
1175
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
356 (if (featurep 'mule)
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
357 ;; note: (int-to-char 65) => ?A
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
358 (let ((ch0 (make-char 'japanese-jisx0208 52 65))
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
359 (ch1 (make-char 'japanese-jisx0208 51 65)))
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
360 (Assert (not (string-match "A" (string ch0))))
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
361 (Assert (not (string-match "[A]" (string ch0))))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
362 (Assert (eq (string-match "[^A]" (string ch0)) 0))
1175
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
363 (Assert (not (string-match "@A" (string ?@ ch0))))
1413
aa15a2bbba1a [xemacs-hg @ 2003-04-15 15:56:56 by stephent]
stephent
parents: 1389
diff changeset
364 (Assert (not (string-match "@[A]" (string ?@ ch0))))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
365 (Assert (eq (string-match "@[^A]" (string ?@ ch0)) 0))
1175
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
366 (Assert (not (string-match "@?A" (string ?@ ch0))))
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
367 (Assert (not (string-match "A" (string ch1))))
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
368 (Assert (not (string-match "[A]" (string ch1))))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
369 (Assert (eq (string-match "[^A]" (string ch1)) 0))
1175
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
370 (Assert (not (string-match "@A" (string ?@ ch1))))
2af1f88a2d31 [xemacs-hg @ 2002-12-27 06:13:13 by stephent]
stephent
parents: 1095
diff changeset
371 (Assert (not (string-match "@[A]" (string ?@ ch1))))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
372 (Assert (eq (string-match "@[^A]" (string ?@ ch1)) 0))
1413
aa15a2bbba1a [xemacs-hg @ 2003-04-15 15:56:56 by stephent]
stephent
parents: 1389
diff changeset
373 (Assert (not (string-match "@?A" (string ?@ ch1))))
aa15a2bbba1a [xemacs-hg @ 2003-04-15 15:56:56 by stephent]
stephent
parents: 1389
diff changeset
374 )
aa15a2bbba1a [xemacs-hg @ 2003-04-15 15:56:56 by stephent]
stephent
parents: 1389
diff changeset
375 )
1195
dff007bd492b [xemacs-hg @ 2003-01-09 12:49:36 by stephent]
stephent
parents: 1175
diff changeset
376
dff007bd492b [xemacs-hg @ 2003-01-09 12:49:36 by stephent]
stephent
parents: 1175
diff changeset
377 ;; More stale match data tests.
dff007bd492b [xemacs-hg @ 2003-01-09 12:49:36 by stephent]
stephent
parents: 1175
diff changeset
378 ;; Thanks to <bjacob@ca.metsci.com>.
1425
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1413
diff changeset
379 ;; These tests used to fail because we cleared match data only on success.
74cb069b8417 [xemacs-hg @ 2003-04-23 15:42:44 by stephent]
stephent
parents: 1413
diff changeset
380 ;; Fixed 2003-04-17.
1612
28ffd53a1d42 [xemacs-hg @ 2003-08-11 10:03:34 by stephent]
stephent
parents: 1472
diff changeset
381 ;; Must change sense of failing tests 2003-05-09. Too much code depends on
28ffd53a1d42 [xemacs-hg @ 2003-08-11 10:03:34 by stephent]
stephent
parents: 1472
diff changeset
382 ;; failed matches preserving match-data.
1472
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
383 (let ((a "a"))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
384 (Assert (string= (progn (string-match "a" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
385 (string-match "b" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
386 (match-string 0 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
387 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
388 (Assert (not (progn (string-match "a" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
389 (string-match "b" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
390 (match-string 1 a))))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
391 ;; test both for the second match is a plain string match and a regexp match
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
392 (Assert (string= (progn (string-match "\\(a\\)" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
393 (string-match "\\(b\\)" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
394 (match-string 0 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
395 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
396 (Assert (string= (progn (string-match "\\(a\\)" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
397 (string-match "b" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
398 (match-string 0 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
399 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
400 (Assert (string= (progn (string-match "\\(a\\)" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
401 (string-match "\\(b\\)" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
402 (match-string 1 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
403 a))
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
404 (Assert (string= (progn (string-match "\\(a\\)" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
405 (string-match "b" a)
4c87ece1e837 [xemacs-hg @ 2003-05-10 07:44:22 by stephent]
stephent
parents: 1425
diff changeset
406 (match-string 1 a))
2542
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
407 a))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
408 ;; in 21.4.16, registers from num_shy_groups to num_groups were not cleared,
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
409 ;; resulting in stale match data
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
410 (Assert (progn (string-match "\\(a\\)" a)
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
411 (string-match "\\(?:a\\)" a)
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
412 (not (match-beginning 1))))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
413 )
2254
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
414
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
415 ;; bug identified by Katsumi Yamaoka 2004-09-03 <b9ywtzbbpue.fsf_-_@jpl.org>
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
416 ;; fix submitted by sjt 2004-09-08
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
417 ;; trailing comments are values from buggy 21.4.15
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
418 (let ((text "abc"))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
419 (Assert (eq 0 (string-match "\\(?:ab+\\)*c" text))) ; 2
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
420 (Assert (eq 0 (string-match "^\\(?:ab+\\)*c" text))) ; nil
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
421 (Assert (eq 0 (string-match "^\\(?:ab+\\)*" text))) ; 0
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
422 (Assert (eq 0 (string-match "^\\(?:ab+\\)c" text))) ; 0
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
423 (Assert (eq 0 (string-match "^\\(?:ab\\)*c" text))) ; 0
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
424 (Assert (eq 0 (string-match "^\\(?:a+\\)*b" text))) ; nil
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
425 (Assert (eq 0 (string-match "^\\(?:a\\)*b" text))) ; 0
2254
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
426 )
cf4470caf504 [xemacs-hg @ 2004-09-08 10:21:57 by stephent]
stephent
parents: 1714
diff changeset
427
2324
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
428 ;; per Steve Youngs 2004-09-30 <microsoft-free.87ekkjhj7t.fsf@youngs.au.com>
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
429 ;; fix submitted by sjt 2004-10-07
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
430 ;; trailing comments are values from buggy 21.4.pre16
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
431 (let ((text "abc"))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
432 (Assert (eq 0 (string-match "\\(?:a\\(b\\)\\)" text))) ; 0
2324
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
433 (Assert (string= (match-string 1 text) "b")) ; ab
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
434 (Assert (null (match-string 2 text))) ; b
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
435 (Assert (null (match-string 3 text))) ; nil
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
436 (Assert (eq 0 (string-match "\\(?:a\\(?:b\\(c\\)\\)\\)" text))) ; 0
2324
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
437 (Assert (string= (match-string 1 text) "c")) ; abc
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
438 (Assert (null (match-string 2 text))) ; ab
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
439 (Assert (null (match-string 3 text))) ; c
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
440 (Assert (null (match-string 4 text))) ; nil
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
441 )
df2fafa399a1 [xemacs-hg @ 2004-10-07 08:01:41 by stephent]
stephent
parents: 2254
diff changeset
442
2542
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
443 ;; trivial subpatterns and backreferences with shy groups
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
444 (let ((text1 "abb")
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
445 (text2 "aba")
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
446 (re0 "\\(a\\)\\(b\\)\\2")
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
447 (re1 "\\(?:a\\)\\(b\\)\\2")
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
448 (re2 "\\(?:a\\)\\(b\\)\\1")
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
449 (re3 "\\(a\\)\\(?:b\\)\\1"))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
450
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
451 (Assert (eq 0 (string-match re0 text1)))
2542
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
452 (Assert (string= text1 (match-string 0 text1)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
453 (Assert (string= "a" (match-string 1 text1)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
454 (Assert (string= "b" (match-string 2 text1)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
455 (Assert (null (string-match re0 text2)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
456
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
457 (Check-Error-Message 'invalid-regexp "Invalid back reference"
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
458 (string-match re1 text1))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
459
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
460 (Assert (eq 0 (string-match re2 text1)))
2542
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
461 (Assert (string= text1 (match-string 0 text1)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
462 (Assert (string= "b" (match-string 1 text1)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
463 (Assert (null (match-string 2 text1)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
464 (Assert (null (string-match re2 text2)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
465
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
466 (Assert (null (string-match re3 text1)))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
467 (Assert (eq 0 (string-match re3 text2)))
2542
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
468 (Assert (string= text2 (match-string 0 text2)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
469 (Assert (string= "a" (match-string 1 text2)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
470 (Assert (null (match-string 2 text2)))
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
471 )
60989130c706 [xemacs-hg @ 2005-02-02 11:37:18 by stephent]
stephent
parents: 2324
diff changeset
472
4199
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
473 ;; replace-regexp-in-string (regexp rep source
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
474 ;; fixedcase literal buf-or-subexp start)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
475
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
476 ;; Currently we test the following cases:
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
477 ;; where `cbuf' and `bar-or-empty' are bound below.
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
478
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
479 ;; #### Tests for the various functional features (fixedcase, literal, start)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
480 ;; should be added.
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
481
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
482 (with-temp-buffer
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
483 (flet ((bar-or-empty (subexp) (if (string= subexp "foo") "bar" "")))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
484 (let ((cbuf (current-buffer)))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
485 (dolist (test-case
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
486 ;; REP BUF-OR-SUBEXP EXPECTED RESULT
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
487 `(("bar" nil " bar")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
488 ("bar" ,cbuf " bar")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
489 ("bar" 0 " bar")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
490 ("bar" 1 " bar foo")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
491 (bar-or-empty nil " ")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
492 (bar-or-empty ,cbuf " ")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
493 (bar-or-empty 0 " ")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
494 (bar-or-empty 1 " bar foo")))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
495 (Assert
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
496 (string=
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
497 (nth 2 test-case)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
498 (replace-regexp-in-string "\\(foo\\).*\\'" (nth 0 test-case)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
499 " foo foo" nil nil (nth 1 test-case)))))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
500 ;; #### Why doesn't this loop work right?
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
501 ; (dolist (test-case
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
502 ; ;; REP BUF-OR-SUBEXP EXPECTED ERROR EXPECTED MESSAGE
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
503 ; `(;; expected message was "bufferp, symbol" up to 21.5.28
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
504 ; ("bar" 'symbol wrong-type-argument "integerp, symbol")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
505 ; ("bar" -1 invalid-argument
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
506 ; "match data register invalid, -1")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
507 ; ("bar" 2 invalid-argument
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
508 ; "match data register not set, 2")
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
509 ; ))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
510 ; (eval
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
511 ; `(Check-Error-Message ,(nth 2 test-case) ,(nth 3 test-case)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
512 ; (replace-regexp-in-string "\\(foo\\).*\\'" ,(nth 0 test-case)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
513 ; " foo foo" nil nil ,(nth 1 test-case)))))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
514 ;; #### Can't test the message with w-t-a, see test-harness.el.
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
515 (Check-Error wrong-type-argument
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
516 (replace-regexp-in-string "\\(foo\\).*\\'"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
517 "bar"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
518 " foo foo" nil nil
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
519 'symbol))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
520 ;; #### Can't test the FROB (-1), see test-harness.el.
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
521 (Check-Error-Message invalid-argument
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
522 "match data register invalid"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
523 (replace-regexp-in-string "\\(foo\\).*\\'"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
524 "bar"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
525 " foo foo" nil nil
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
526 -1))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
527 ;; #### Can't test the FROB (-1), see test-harness.el.
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
528 (Check-Error-Message invalid-argument
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
529 "match data register not set"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
530 (replace-regexp-in-string "\\(foo\\).*\\'"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
531 "bar"
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
532 " foo foo" nil nil
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
533 2))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
534 )))
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
535
4504
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
536 ;; Not very comprehensive tests of skip-chars-forward, skip-chars-background:
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
537
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
538 (with-string-as-buffer-contents
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
539 "-]-----------------------------][]]------------------------"
4517
5e8f6469169f Fix up initial condition for skip-chars test.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4504
diff changeset
540 (goto-char (point-min))
4504
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
541 (skip-chars-forward (skip-chars-quote "-[]"))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
542 (Assert (= (point) (point-max)))
4504
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
543 (skip-chars-backward (skip-chars-quote "-[]"))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
544 (Assert (= (point) (point-min)))
4504
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
545 ;; Testing in passing for an old bug in #'skip-chars-forward where I
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
546 ;; thought it was impossible to call it with a string containing only ?-
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
547 ;; and ?]:
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
548 (Assert (= (skip-chars-forward (skip-chars-quote "-]"))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
549 (position ?[ (buffer-string) :test #'=)))
4504
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
550 ;; This used to error, incorrectly:
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
551 (Assert (skip-chars-quote "[-")))
b82fdf7305ee Correct the implementation, add a few basic tests for #'skip-chars-quote.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4199
diff changeset
552
4199
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
553 ;; replace-match (REPLACEMENT &optional FIXEDCASE LITERAL STRING STRBUFFER)
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
554
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
555 ;; #### Write some tests! Much functionality is implicitly tested above
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
556 ;; via `replace-regexp-in-string', but we should specifically test bogus
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
557 ;; combinations of STRING and STRBUFFER.
3660d327399f [xemacs-hg @ 2007-10-01 08:07:39 by stephent]
stephent
parents: 2542
diff changeset
558
4518
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
559 ;; empty string at point
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
560 ;; Thanks Julian Bradford on XEmacs Beta
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
561 ;; <18652.54975.894512.880956@krk.inf.ed.ac.uk>
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
562 (with-string-as-buffer-contents "aáa"
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
563 (goto-char (point-min))
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
564 (Assert (looking-at "\\="))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
565 (Assert (= (re-search-forward "\\=") 1))
4518
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
566 (forward-char 1)
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
567 (Assert (looking-at "\\="))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
568 (Assert (= (re-search-forward "\\=") 2))
4518
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
569 (forward-char 1)
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
570 (Assert (looking-at "\\="))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
571 (Assert (= (re-search-forward "\\=") 3))
4518
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
572 (forward-char 1)
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
573 (Assert (looking-at "\\="))
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
574 (Assert (= (re-search-forward "\\=") 4)))
4518
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
575
e0a8c796f955 Add test for at_dot regexp.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4517
diff changeset
576
4897
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
577 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
578 ;; Tests involving case-changing replace-match ;;
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
579 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
580
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
581 (Assert (not (string-match "\\(\\.\\=\\)" ".")))
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
582 (Assert (string= "" (let ((str "test string"))
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
583 (if (string-match "^.*$" str)
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
584 (replace-match "\\U" t nil str)))))
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
585 (with-temp-buffer
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
586 (erase-buffer)
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
587 (insert "test string")
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
588 (re-search-backward "^.*$")
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
589 (replace-match "\\U" t)
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
590 (Assert (and (bobp) (eobp))))
91a023144e72 fix longstanding search bug involving searching for Control-1 chars
Ben Wing <ben@xemacs.org>
parents: 4855
diff changeset
591
4900
0eccfd4850d6 Add tests for the regexp-ranges-treat-control-1-chars badly bug.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4897
diff changeset
592 ;; Control-1 characters were second-class citizens in regexp ranges
0eccfd4850d6 Add tests for the regexp-ranges-treat-control-1-chars badly bug.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4897
diff changeset
593 ;; for a while there. Addressed in Ben's Mercurial changeset
0eccfd4850d6 Add tests for the regexp-ranges-treat-control-1-chars badly bug.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4897
diff changeset
594 ;; 2e15c29cc2b3; attempt to ensure this doesn't happen again.
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
595 (Assert (eql (string-match "[\x00-\x7f\x80-\x9f]" "a") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
596 (Assert (eql (string-match "[\x00-\x7f\x80-\x9f]" "é") nil))
4900
0eccfd4850d6 Add tests for the regexp-ranges-treat-control-1-chars badly bug.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4897
diff changeset
597 ;; Gave nil in 21.5 for a couple of years.
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
598 (Assert (eql (string-match "[\x00-\x7f\x80-\x9f]" "\x80") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
599 (Assert (eql (string-match "[\x00-\x7f]\\|[\x80-\x9f]" "\x80") 0))
4900
0eccfd4850d6 Add tests for the regexp-ranges-treat-control-1-chars badly bug.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4897
diff changeset
600 ;; Gave nil
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
601 (Assert (eql (string-match "[\x7f\x80-\x9f]" "\x80") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
602 (Assert (eql (string-match "[\x80-\x9f]" "\x80") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
603 (Assert (eql (string-match "[\x7f\x80-\x9e]" "\x80") 0))
4900
0eccfd4850d6 Add tests for the regexp-ranges-treat-control-1-chars badly bug.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4897
diff changeset
604 ;; Used to succeed even with the bug.
5136
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
605 (Assert (eql (string-match "[\x7f\x80\x9f]" "\x80") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
606 (Assert (eql (string-match "[\x7e\x80-\x9f]" "\x80") 0))
0f66906b6e37 Undo Assert-equal, Assert=, etc.; make `Assert' handle this automatically
Ben Wing <ben@xemacs.org>
parents: 4906
diff changeset
607 (Assert (eql (string-match "[\x7f\x81-\x9f]" "\x81") 0))
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
608
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
609 ;; Test character classes
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
610
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
611 ;; This used not to error:
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
612 (Check-Error-Message invalid-regexp "Invalid character class name"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
613 (string-match "[[:alnum12345:]]" "a"))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
614 ;; This alwayed errored, as long as character classes were turned on
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
615 (Check-Error-Message invalid-regexp "Invalid character class name"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
616 (string-match "[[:alnum1234:]]" "a"))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
617
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
618 (macrolet
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
619 ((Assert-char-class (class matching-char non-matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
620 (if (and (not (featurep 'mule))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
621 (or (eq (car-safe matching-char) 'decode-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
622 (eq (car-safe non-matching-char) 'decode-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
623 ;; Don't attempt expansion if these clauses require Mule and we
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
624 ;; don't have it.
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
625 (return-from Assert-char-class nil)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
626 (setq matching-char (eval matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
627 non-matching-char (eval non-matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
628 `(progn
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
629 (Assert (eql (string-match ,(concat "[" class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
630 ,(concat (string matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
631 (string non-matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
632 0))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
633 (Assert (eql (string-match ,(concat "[" class class class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
634 ,(concat (string matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
635 (string non-matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
636 0))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
637 (Assert (eql (string-match ,(concat "[^" class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
638 ,(concat (string non-matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
639 (string matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
640 0))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
641 (Assert (eql (string-match ,(concat "[^" class class class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
642 ,(concat (string non-matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
643 (string matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
644 0))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
645 (Assert (eql (string-match ,(concat "[" class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
646 ,(concat (string non-matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
647 (string matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
648 1))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
649 (Assert (eql (string-match ,(concat "[" class class class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
650 ,(concat (string non-matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
651 (string matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
652 1))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
653 (Assert (eql (string-match ,(concat "[^" class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
654 ,(concat (string matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
655 (string non-matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
656 1))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
657 (Assert (eql (string-match ,(concat "[^" class class class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
658 ,(concat (string matching-char)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
659 (string non-matching-char)))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
660 1))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
661 (Assert (null (string-match ,(concat "[" class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
662 ,(string non-matching-char))))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
663 (Assert (null (string-match ,(concat "[^" class "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
664 ,(string matching-char))))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
665 (Assert (null (string-match ,(concat "[^" class
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
666 (string non-matching-char) "]")
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
667 ,(concat (string matching-char)
5653
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
668 (string non-matching-char)))))
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
669 (let ((old-case-fold-search case-fold-search))
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
670 (with-temp-buffer
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
671 (setq case-fold-search old-case-fold-search)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
672 (insert-char ,matching-char 20)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
673 (insert-char ,non-matching-char 20)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
674 (goto-char (point-min))
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
675 (Assert (eql (skip-chars-forward ,class) 20)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
676 ,(format "making sure %s skips %S forward"
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
677 class matching-char))
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
678 (Assert (eql (skip-chars-forward ,(concat "^" class)) 20)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
679 ,(format "making sure ^%s skips %S forward"
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
680 class non-matching-char))
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
681 (Assert (eql (skip-chars-backward ,(concat "^" class)) -20)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
682 ,(format "making sure ^%s skips %S backward"
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
683 class non-matching-char))
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
684 (Assert (eql (skip-chars-backward ,class) -20)
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
685 ,(format "making sure %s skips %S backward"
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
686 class matching-char))))))
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
687 (Assert-never-matching (class &rest characters)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
688 (cons
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
689 'progn
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
690 (mapcan #'(lambda (character)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
691 (if (or (not (eq 'decode-char (car-safe character)))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
692 (featurep 'mule))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
693 `((Assert (null (string-match
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
694 ,(concat "[" class "]")
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
695 ,(string (eval character)))))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
696 (Assert (eql (string-match
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
697 ,(concat "[^" class "]")
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
698 ,(string (eval character)))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
699 0)))))
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
700 characters))))
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
701 (Assert-char-class "[:alpha:]" ?a ?0)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
702 (Assert-char-class "[:alpha:]" ?z ?9)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
703 (Assert-char-class "[:alpha:]" ?A ?0)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
704 (Assert-char-class "[:alpha:]" ?Z ?9)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
705 (Assert-char-class "[:alpha:]" ?b ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
706 (Assert-char-class "[:alpha:]" ?c ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
707 (Assert-char-class "[:alpha:]" ?d ?\ )
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
708 (Assert-char-class "[:alpha:]" ?e ?\x7f)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
709 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
710 "[:alpha:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
711 (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
712 (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
713 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
714 "[:alpha:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
715 (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
716 ?\x02)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
717 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
718 "[:alpha:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
719 (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
720 (decode-char 'ucs #x0385)) ;; GREEK DIALYTIKA TONOS
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
721
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
722 (Assert-char-class "[:alnum:]" ?a ?.)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
723 (Assert-char-class "[:alnum:]" ?z ?')
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
724 (Assert-char-class "[:alnum:]" ?A ?/)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
725 (Assert-char-class "[:alnum:]" ?Z ?!)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
726 (Assert-char-class "[:alnum:]" ?0 ?,)
5653
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
727 (Assert-char-class "[:alnum:]" ?9 ?\t)
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
728 (Assert-char-class "[:alnum:]" ?b ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
729 (Assert-char-class "[:alnum:]" ?c ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
730 (Assert-char-class "[:alnum:]" ?d ?\ )
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
731 (Assert-char-class "[:alnum:]" ?e ?\x7f)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
732 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
733 "[:alnum:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
734 (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
735 (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
736 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
737 "[:alnum:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
738 (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
739 ?\x02)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
740 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
741 "[:alnum:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
742 (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
743 (decode-char 'ucs #x0385)) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
744
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
745 (Assert-char-class "[:word:]" ?a ?.)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
746 (Assert-char-class "[:word:]" ?z ?')
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
747 (Assert-char-class "[:word:]" ?A ?/)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
748 (Assert-char-class "[:word:]" ?Z ?!)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
749 (Assert-char-class "[:word:]" ?0 ?,)
5653
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
750 (Assert-char-class "[:word:]" ?9 ?\t)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
751 (Assert-char-class "[:word:]" ?b ?\x00)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
752 (Assert-char-class "[:word:]" ?c ?\x09)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
753 (Assert-char-class "[:word:]" ?d ?\ )
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
754 (Assert-char-class "[:word:]" ?e ?\x7f)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
755 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
756 "[:word:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
757 (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
758 (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
759 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
760 "[:word:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
761 (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
762 ?\x02)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
763 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
764 "[:word:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
765 (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
766 (decode-char 'ucs #x0385)) ;; GREEK DIALYTIKA TONOS
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
767
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
768 (let ((case-fold-search nil))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
769 (Assert-char-class "[:upper:]" ?A ?a)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
770 (Assert-char-class "[:upper:]" ?Z ?z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
771 (Assert-char-class "[:upper:]" ?B ?0)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
772 (Assert-char-class "[:upper:]" ?C ?9)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
773 (Assert-char-class "[:upper:]" ?D ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
774 (Assert-char-class "[:upper:]" ?E ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
775 (Assert-char-class "[:upper:]" ?F ?\ )
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
776 (Assert-char-class "[:upper:]" ?G ?\x7f)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
777 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
778 "[:upper:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
779 (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
780 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
781 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
782 "[:upper:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
783 (decode-char 'ucs #x0392) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
784 (decode-char 'ucs #x5357)) ;; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
785
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
786 (Assert-char-class "[:lower:]" ?a ?A)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
787 (Assert-char-class "[:lower:]" ?z ?Z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
788 (Assert-char-class "[:lower:]" ?b ?0)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
789 (Assert-char-class "[:lower:]" ?c ?9)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
790 (Assert-char-class "[:lower:]" ?d ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
791 (Assert-char-class "[:lower:]" ?e ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
792 (Assert-char-class "[:lower:]" ?f ? )
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
793 (Assert-char-class "[:lower:]" ?g ?\x7f)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
794 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
795 "[:lower:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
796 (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
797 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
798 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
799 "[:lower:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
800 (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
801 (decode-char 'ucs #x5357)));; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
802
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
803 (let ((case-fold-search t))
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
804 (Assert-char-class "[:upper:]" ?a ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
805 (Assert-char-class "[:upper:]" ?z ?\x01)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
806 (Assert-char-class "[:upper:]" ?b ?{)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
807 (Assert-char-class "[:upper:]" ?c ?})
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
808 (Assert-char-class "[:upper:]" ?d ?<)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
809 (Assert-char-class "[:upper:]" ?e ?>)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
810 (Assert-char-class "[:upper:]" ?f ?\ )
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
811 (Assert-char-class "[:upper:]" ?g ?\x7f)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
812 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
813 "[:upper:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
814 (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
815 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
816 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
817 "[:upper:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
818 (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
819 (decode-char 'ucs #x5357)) ;; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
820 (Assert-char-class "[:lower:]" ?A ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
821 (Assert-char-class "[:lower:]" ?Z ?\x01)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
822 (Assert-char-class "[:lower:]" ?B ?{)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
823 (Assert-char-class "[:lower:]" ?C ?})
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
824 (Assert-char-class "[:lower:]" ?D ?<)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
825 (Assert-char-class "[:lower:]" ?E ?>)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
826 (Assert-char-class "[:lower:]" ?F ?\ )
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
827 (Assert-char-class "[:lower:]" ?G ?\x7F)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
828 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
829 "[:lower:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
830 (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
831 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
832 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
833 "[:lower:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
834 (decode-char 'ucs #x0392) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
835 (decode-char 'ucs #x5357)));; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
836
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
837 (Assert-char-class "[:digit:]" ?0 ?a)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
838 (Assert-char-class "[:digit:]" ?9 ?z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
839 (Assert-char-class "[:digit:]" ?1 ?A)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
840 (Assert-char-class "[:digit:]" ?2 ?Z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
841 (Assert-char-class "[:digit:]" ?3 ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
842 (Assert-char-class "[:digit:]" ?4 ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
843 (Assert-char-class "[:digit:]" ?5 ? )
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
844 (Assert-char-class "[:digit:]" ?6 ?\x7f)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
845 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
846 "[:digit:]" ?7
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
847 (decode-char 'ucs #x0385)) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
848 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
849 "[:digit:]" ?8
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
850 (decode-char 'ucs #x0392)) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
851 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
852 "[:digit:]" ?9
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
853 (decode-char 'ucs #x03B2)) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
854 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
855 "[:digit:]" ?0
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
856 (decode-char 'ucs #x0410)) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
857 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
858 "[:digit:]" ?1
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
859 (decode-char 'ucs #x0430)) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
860 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
861 "[:digit:]" ?2
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
862 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
863 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
864 "[:digit:]" ?3
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
865 (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
866 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
867 "[:digit:]" ?4
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
868 (decode-char 'ucs #x5357)) ;; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
869
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
870 (Assert-char-class "[:xdigit:]" ?0 ?g)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
871 (Assert-char-class "[:xdigit:]" ?9 ?G)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
872 (Assert-char-class "[:xdigit:]" ?A ?{)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
873 (Assert-char-class "[:xdigit:]" ?a ?})
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
874 (Assert-char-class "[:xdigit:]" ?1 ? )
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
875 (Assert-char-class "[:xdigit:]" ?2 ?Z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
876 (Assert-char-class "[:xdigit:]" ?3 ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
877 (Assert-char-class "[:xdigit:]" ?4 ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
878 (Assert-char-class "[:xdigit:]" ?5 ?\x7f)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
879 (Assert-char-class "[:xdigit:]" ?6 ?z)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
880 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
881 "[:xdigit:]" ?7
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
882 (decode-char 'ucs #x0385)) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
883 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
884 "[:xdigit:]" ?8
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
885 (decode-char 'ucs #x0392)) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
886 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
887 "[:xdigit:]" ?9
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
888 (decode-char 'ucs #x03B2)) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
889 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
890 "[:xdigit:]" ?a
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
891 (decode-char 'ucs #x0410)) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
892 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
893 "[:xdigit:]" ?B
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
894 (decode-char 'ucs #x0430)) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
895 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
896 "[:xdigit:]" ?c
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
897 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
898 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
899 "[:xdigit:]" ?D
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
900 (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
901 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
902 "[:xdigit:]" ?e
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
903 (decode-char 'ucs #x5357)) ;; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
904
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
905 (Assert-char-class "[:space:]" ?\ ?0)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
906 (Assert-char-class "[:space:]" ?\t ?9)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
907 (Assert-char-class "[:space:]" ?\ ?A)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
908 (Assert-char-class "[:space:]" ?\t ?Z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
909 (Assert-char-class "[:space:]" ?\ ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
910 (Assert-char-class "[:space:]" ?\ ?\x7f)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
911 (Assert-char-class "[:space:]" ?\t ?a)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
912 (Assert-char-class "[:space:]" ?\ ?z)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
913 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
914 "[:space:]" ?\
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
915 (decode-char 'ucs #x0385)) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
916 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
917 "[:space:]" ?\t
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
918 (decode-char 'ucs #x0392)) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
919 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
920 "[:space:]" ?\
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
921 (decode-char 'ucs #x03B2)) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
922 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
923 "[:space:]" ?\t
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
924 (decode-char 'ucs #x0410)) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
925 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
926 "[:space:]" ?\
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
927 (decode-char 'ucs #x0430)) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
928 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
929 "[:space:]" ?\t
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
930 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
931 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
932 "[:space:]" ?\
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
933 (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
934 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
935 "[:space:]" ?\t
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
936 (decode-char 'ucs #x5357)) ;; kDefinition south; southern part; southward
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
937
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
938 (Assert-char-class "[:print:]" ?\ ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
939 (Assert-char-class "[:print:]" ?0 ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
940 (Assert-char-class "[:print:]" ?9 ?\x7f)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
941 (Assert-char-class "[:print:]" ?A ?\x01)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
942 (Assert-char-class "[:print:]" ?Z ?\x02)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
943 (Assert-char-class "[:print:]" ?B ?\t)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
944 (Assert-char-class "[:print:]" ?a ?\x03)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
945 (Assert-char-class "[:print:]" ?z ?\x04)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
946 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
947 "[:print:]" (decode-char 'ucs #x0385) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
948 ?\x05)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
949 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
950 "[:print:]" (decode-char 'ucs #x0392) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
951 ?\x06)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
952 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
953 "[:print:]" (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
954 ?\x07)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
955 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
956 "[:print:]" (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
957 ?\x08)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
958 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
959 "[:print:]" (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
960 ?\x09)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
961 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
962 "[:print:]" (decode-char 'ucs #x0686) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
963 ?\x0a)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
964 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
965 "[:print:]" (decode-char 'ucs #x2116) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
966 ?\x0b)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
967 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
968 "[:print:]" (decode-char 'ucs #x5357) ;; kDefinition south; southern part; southward
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
969 ?\x0c)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
970
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
971 (Assert-char-class "[:graph:]" ?! ?\ )
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
972 (Assert-char-class "[:graph:]" ?0 ?\x09)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
973 (Assert-char-class "[:graph:]" ?9 ?\x7f)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
974 (Assert-char-class "[:graph:]" ?A ?\x01)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
975 (Assert-char-class "[:graph:]" ?Z ?\x02)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
976 (Assert-char-class "[:graph:]" ?B ?\t)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
977 (Assert-char-class "[:graph:]" ?a ?\x03)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
978 (Assert-char-class "[:graph:]" ?z ?\x04)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
979 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
980 "[:graph:]" (decode-char 'ucs #x0385) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
981 ?\x05)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
982 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
983 "[:graph:]" (decode-char 'ucs #x0392) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
984 ?\x06)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
985 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
986 "[:graph:]" (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
987 ?\x07)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
988 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
989 "[:graph:]" (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
990 ?\x08)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
991 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
992 "[:graph:]" (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
993 ?\x09)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
994 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
995 "[:graph:]" (decode-char 'ucs #x0686) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
996 ?\x0a)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
997 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
998 "[:graph:]" (decode-char 'ucs #x2116) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
999 ?\x0b)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1000 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1001 "[:graph:]" (decode-char 'ucs #x5357) ;; kDefinition south; southern part; southward
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1002 ?\x0c)
5647
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1003
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1004 (Assert-char-class "[:punct:]" ?\( ?0)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1005 (Assert-char-class "[:punct:]" ?. ?9)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1006 (Assert-char-class "[:punct:]" ?{ ?A)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1007 (Assert-char-class "[:punct:]" ?} ?Z)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1008 (Assert-char-class "[:punct:]" ?: ?\t)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1009 (Assert-char-class "[:punct:]" ?\; ?\x00)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1010 (Assert-char-class "[:punct:]" ?< ?\x09)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1011 (Assert-char-class "[:punct:]" ?> ?\x7f)
1d9f603e9125 Turn on character classes in regex.c by default; test them in regexp-tests.el
Aidan Kehoe <kehoea@parhasard.net>
parents: 5402
diff changeset
1012 (Assert-char-class "[:punct:]" ?= ?a)
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1013 (Assert-char-class "[:punct:]" ?\? ?z)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1014 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1015 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1016 (decode-char 'ucs #x0385) ;; GREEK DIALYTIKA TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1017 ?a)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1018 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1019 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1020 (decode-char 'ucs #x20af) ;; DRACHMA SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1021 (decode-char 'ucs #x0392)) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1022 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1023 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1024 (decode-char 'ucs #x00a7) ;; SECTION SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1025 (decode-char 'ucs #x03B2)) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1026 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1027 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1028 (decode-char 'ucs #x00a8) ;; DIAERESIS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1029 (decode-char 'ucs #x0410)) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1030 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1031 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1032 (decode-char 'ucs #x0384) ;; GREEK TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1033 (decode-char 'ucs #x0430)) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1034 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1035 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1036 (decode-char 'ucs #x00b7) ;; MIDDLE DOT
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1037 (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1038 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1039 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1040 (decode-char 'ucs #x2116) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1041 ?x)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1042 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1043 "[:punct:]"
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1044 ?=
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1045 (decode-char 'ucs #x5357)) ;; kDefinition south; southern part; southward
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1046
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1047 (Assert-char-class "[:ascii:]" ?a (decode-char 'ucs #x00a7)) ;; SECTION SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1048 (Assert-char-class "[:ascii:]" ?b (decode-char 'ucs #x00a8)) ;; DIAERESIS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1049 (Assert-char-class "[:ascii:]" ?c (decode-char 'ucs #x00b7)) ;; MIDDLE DOT
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1050 (Assert-char-class "[:ascii:]" ?d (decode-char 'ucs #x0384)) ;; GREEK TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1051 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1052 "[:ascii:]" ?\x00 (decode-char 'ucs #x0392)) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1053 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1054 "[:ascii:]" ?\x01 (decode-char 'ucs #x03B2)) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1055 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1056 "[:ascii:]" ?\t (decode-char 'ucs #x0410)) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1057 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1058 "[:ascii:]" ?A (decode-char 'ucs #x0430)) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1059 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1060 "[:ascii:]" ?B (decode-char 'ucs #x0686)) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1061 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1062 "[:ascii:]" ?C (decode-char 'ucs #x20af)) ;; DRACHMA SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1063 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1064 "[:ascii:]" ?\x7f (decode-char 'ucs #x2116)) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1065
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1066 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1067 "[:nonascii:]" (decode-char 'ucs #x00a7) ?a) ;; SECTION SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1068 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1069 "[:nonascii:]" (decode-char 'ucs #x00a8) ?b) ;; DIAERESIS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1070 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1071 "[:nonascii:]" (decode-char 'ucs #x00b7) ?c) ;; MIDDLE DOT
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1072 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1073 "[:nonascii:]" (decode-char 'ucs #x0384) ?d) ;; GREEK TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1074 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1075 "[:nonascii:]" (decode-char 'ucs #x0392) ?\x00) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1076 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1077 "[:nonascii:]" (decode-char 'ucs #x03B2) ?\x01) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1078 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1079 "[:nonascii:]" (decode-char 'ucs #x0410) ?\t) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1080 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1081 "[:nonascii:]" (decode-char 'ucs #x0430) ?A) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1082 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1083 "[:nonascii:]" (decode-char 'ucs #x0686) ?B) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1084 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1085 "[:nonascii:]" (decode-char 'ucs #x20af) ?C) ;; DRACHMA SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1086 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1087 "[:nonascii:]" (decode-char 'ucs #x2116) ?\x7f) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1088
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1089 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1090 "[:multibyte:]" (decode-char 'ucs #x00a7) ?a) ;; SECTION SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1091 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1092 "[:multibyte:]" (decode-char 'ucs #x00a8) ?b) ;; DIAERESIS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1093 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1094 "[:multibyte:]" (decode-char 'ucs #x00b7) ?c) ;; MIDDLE DOT
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1095 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1096 "[:multibyte:]" (decode-char 'ucs #x0384) ?d) ;; GREEK TONOS
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1097 (Assert-char-class
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1098 "[:multibyte:]" (decode-char 'ucs #x0392)
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1099 ?\x00) ;; GREEK CAPITAL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1100
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1101 (Assert-never-matching
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1102 "[:unibyte:]"
5653
3df910176b6a Support predefined character classes in #'skip-chars-{forward,backward}, too
Aidan Kehoe <kehoea@parhasard.net>
parents: 5649
diff changeset
1103 ?\x80 ?\xe4 ?\xdf ?\xf8
5648
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1104 (decode-char 'ucs #x03B2) ;; GREEK SMALL LETTER BETA
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1105 (decode-char 'ucs #x0410) ;; CYRILLIC CAPITAL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1106 (decode-char 'ucs #x0430) ;; CYRILLIC SMALL LETTER A
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1107 (decode-char 'ucs #x0686) ;; ARABIC LETTER TCHEH
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1108 (decode-char 'ucs #x20af) ;; DRACHMA SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1109 (decode-char 'ucs #x2116) ;; NUMERO SIGN
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1110 (decode-char 'ucs #x5357))) ;; kDefinition south; southern part; southward
3f4a234f4672 Support non-ASCII correctly in character classes, test this.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5647
diff changeset
1111
5680
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1112 (with-temp-buffer
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1113 (insert "hi there")
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1114 (goto-char 1)
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1115 (set-syntax-table (copy-syntax-table))
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1116 (modify-syntax-entry 'ascii "<")
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1117 (Assert (null (re-search-forward "[[:alnum:]]" nil t))
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1118 "checking that a bug with dirty syntax table caches has been fixed"))
8a2ac78cb97d Pre-emptively update any dirty mirror syntax table before searching
Aidan Kehoe <kehoea@parhasard.net>
parents: 5653
diff changeset
1119