comparison tests/automated/regexp-tests.el @ 1024:ccaf90c5a53a

[xemacs-hg @ 2002-10-02 09:29:37 by stephent] 21.4 -> R21.5 stuff manual improvements <87k7l1p6su.fsf@tleepslib.sk.tsukuba.ac.jp> regexp tests <87fzvpp6mf.fsf@tleepslib.sk.tsukuba.ac.jp> add-to-list doc Ville Skyttä <87bs6dp6io.fsf@tleepslib.sk.tsukuba.ac.jp> Move filename associations Ville Skyttä <877kh1p6ee.fsf@tleepslib.sk.tsukuba.ac.jp> lookup-syntax-properties <87admil2e0.fsf_-_@tleepslib.sk.tsukuba.ac.jp> fix stale submatches <873crpp50v.fsf_-_@tleepslib.sk.tsukuba.ac.jp> info for developers <87y99hnqc4.fsf@tleepslib.sk.tsukuba.ac.jp>
author stephent
date Wed, 02 Oct 2002 09:31:40 +0000
parents 3078fd1074e8
children 0d33547d9ed3
comparison
equal deleted inserted replaced
1023:ce9bdd48654f 1024:ccaf90c5a53a
211 (goto-char (point-min)) 211 (goto-char (point-min))
212 (search-forward "this is a test ") 212 (search-forward "this is a test ")
213 (looking-at "Unmatchable text") 213 (looking-at "Unmatchable text")
214 (replace-match "") 214 (replace-match "")
215 (Assert (looking-at "^buffer.$"))) 215 (Assert (looking-at "^buffer.$")))
216
217 ;; Test that trivial regexps reset unused registers
218 ;; Thanks to Martin Sternholm for the report.
219 ;; xemacs-beta <5blm6h2ki5.fsf@lister.roxen.com>
220 (with-temp-buffer
221 (insert "ab")
222 (goto-char (point-min))
223 (re-search-forward "\\(a\\)")
224 ;; test the whole-match data, too -- one try scotched that, too!
225 (Assert (string= (match-string 0) "a"))
226 (Assert (string= (match-string 1) "a"))
227 (re-search-forward "b")
228 (Assert (string= (match-string 0) "b"))
229 (Assert (string= (match-string 1) nil)))
230
231 ;; Test word boundaries
232 (Assert (= (string-match " \\<a" " a") 0))
233 (Assert (= (string-match "a\\> " "a ") 0))
234 (Assert (= (string-match " \\ba" " a") 0))
235 (Assert (= (string-match "a\\b " "a ") 0))
236 (Assert (= (string-match "\\ba" " a") 1))
237 (Assert (= (string-match "a\\b" "a ") 0))
238 ;; should work at target boundaries
239 (Assert (= (string-match "\\<a" "a") 0))
240 (Assert (= (string-match "a\\>" "a") 0))
241 (Assert (= (string-match "\\ba" "a") 0))
242 (Assert (= (string-match "a\\b" "a") 0))
243 ;; but not if the "word" would be on the null side of the boundary!
244 (Assert (not (string-match "\\<" "")))
245 (Assert (not (string-match "\\>" "")))
246 (Assert (not (string-match " \\<" " ")))
247 (Assert (not (string-match "\\> " " ")))
248 (Assert (not (string-match "a\\<" "a")))
249 (Assert (not (string-match "\\>a" "a")))
250 ;; Expect these to fail :-(
251 (Assert (not (string-match "\\b" "")))
252 (Assert (not (string-match " \\b" " ")))
253 (Assert (not (string-match "\\b " " ")))