comparison tests/automated/regexp-tests.el @ 1714:61179c12fbb7

[xemacs-hg @ 2003-09-25 11:59:20 by stephent] test a{} regexps <873celdqr1.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Thu, 25 Sep 2003 11:59:24 +0000
parents 28ffd53a1d42
children cf4470caf504
comparison
equal deleted inserted replaced
1713:8b81e1af576e 1714:61179c12fbb7
149 (Assert (not (string-match "^\\(ä\\)\\1$" "Ää"))) 149 (Assert (not (string-match "^\\(ä\\)\\1$" "Ää")))
150 (Assert (not (string-match "^\\(Ä\\)\\1$" "ää"))) 150 (Assert (not (string-match "^\\(Ä\\)\\1$" "ää")))
151 (Assert (not (string-match "^\\(Ä\\)\\1$" "äÄ"))) 151 (Assert (not (string-match "^\\(Ä\\)\\1$" "äÄ")))
152 (Assert (string-match "^\\(Ä\\)\\1$" "ÄÄ")) 152 (Assert (string-match "^\\(Ä\\)\\1$" "ÄÄ"))
153 (Assert (not (string-match "^\\(Ä\\)\\1$" "Ää")))) 153 (Assert (not (string-match "^\\(Ä\\)\\1$" "Ää"))))
154
155 ;; multiple-match
156 ;; Thanks to Manfred Bartz <MBartz@xix.com>
157 ;; c.e.x <vn4rkkm7ouf3b5@corp.supernews.com>
158 ;; #### Need to do repetitions of more complex regexps
159 ;; #### WASH ME!
160 (with-temp-buffer
161 (Assert (not (string-match "^a\\{4,4\\}$" "aaa")))
162 (Assert (string-match "^a\\{4,4\\}$" "aaaa"))
163 (Assert (not (string-match "^a\\{4,4\\}$" "aaaaa")))
164 (Assert (not (string-match "^[a]\\{4,4\\}$" "aaa")))
165 (Assert (string-match "^[a]\\{4,4\\}$" "aaaa"))
166 (Assert (not (string-match "^[a]\\{4,4\\}$" "aaaaa")))
167 (Assert (not (string-match "^\\(a\\)\\{4,4\\}$" "aaa")))
168 (Assert (string-match "^\\(a\\)\\{4,4\\}$" "aaaa"))
169 (Assert (not (string-match "^\\(a\\)\\{4,4\\}$" "aaaaa")))
170 ;; Use class because repetition of single char broken in 21.5.15
171 (Assert (not (string-match "^[a]\\{3,5\\}$" "aa")))
172 (Assert (string-match "^[a]\\{3,5\\}$" "aaa"))
173 (Assert (string-match "^[a]\\{3,5\\}$" "aaaa"))
174 (Assert (string-match "^[a]\\{3,5\\}$" "aaaaa"))
175 (Assert (not (string-match "^[a]\\{3,5\\}$" "aaaaaa")))
176 (insert "\
177 aa
178 aaa
179 aaaa
180 aaaaa
181 aaaaaa
182 baaaa
183 ")
184 (goto-char (point-min))
185 (forward-line 1)
186 (Assert (not (looking-at "^a\\{4,4\\}$")))
187 (forward-line 1)
188 (Assert (looking-at "^a\\{4,4\\}$"))
189 (forward-line 1)
190 (Assert (not (looking-at "^a\\{4,4\\}$")))
191 (goto-char (point-min))
192 (forward-line 1)
193 (Assert (not (looking-at "^[a]\\{4,4\\}$")))
194 (forward-line 1)
195 (Assert (looking-at "^[a]\\{4,4\\}$"))
196 (forward-line 1)
197 (Assert (not (looking-at "^[a]\\{4,4\\}$")))
198 (goto-char (point-min))
199 (forward-line 1)
200 (Assert (not (looking-at "^\\(a\\)\\{4,4\\}$")))
201 (forward-line 1)
202 (Assert (looking-at "^\\(a\\)\\{4,4\\}$"))
203 (forward-line 1)
204 (Assert (not (looking-at "^\\(a\\)\\{4,4\\}$")))
205 ;; Use class because repetition of single char broken in 21.5.15
206 (goto-char (point-min))
207 (Assert (not (looking-at "^[a]\\{3,5\\}$")))
208 (forward-line 1)
209 (Assert (looking-at "^[a]\\{3,5\\}$"))
210 (forward-line 1)
211 (Assert (looking-at "^[a]\\{3,5\\}$"))
212 (forward-line 1)
213 (Assert (looking-at "^[a]\\{3,5\\}$"))
214 (forward-line 1)
215 (Assert (not (looking-at "^[a]\\{3,5\\}$")))
216 (goto-char (point-min))
217 (Assert (= 12 (re-search-forward "a\\{4,4\\}")))
218 (goto-char (point-min))
219 (Assert (= 12 (re-search-forward "b?a\\{4,4\\}")))
220 (goto-char (point-min))
221 (Assert (= 31 (re-search-forward "ba\\{4,4\\}")))
222 (goto-char (point-min))
223 (Assert (= 31 (re-search-forward "[b]a\\{4,4\\}")))
224 (goto-char (point-min))
225 (Assert (= 31 (re-search-forward "\\(b\\)a\\{4,4\\}")))
226 (goto-char (point-min))
227 (Assert (= 12 (re-search-forward "^a\\{4,4\\}")))
228 (goto-char (point-min))
229 (Assert (= 12 (re-search-forward "^a\\{4,4\\}$")))
230 (goto-char (point-min))
231 (Assert (= 12 (re-search-forward "[a]\\{4,4\\}")))
232 (goto-char (point-min))
233 (Assert (= 12 (re-search-forward "^[a]\\{4,4\\}")))
234 (goto-char (point-min))
235 (Assert (= 12 (re-search-forward "^[a]\\{4,4\\}$")))
236 )
154 237
155 ;; charset, charset_not 238 ;; charset, charset_not
156 ;; Not called because it takes too much time. 239 ;; Not called because it takes too much time.
157 (defun test-regexp-charset-paranoid () 240 (defun test-regexp-charset-paranoid ()
158 (let ((i 0) 241 (let ((i 0)