Mercurial > hg > xemacs-beta
comparison tests/automated/regexp-tests.el @ 1472:4c87ece1e837
[xemacs-hg @ 2003-05-10 07:44:22 by stephent]
tests for no-clobber-on-fail <87k7czs0xd.fsf@tleepslib.sk.tsukuba.ac.jp>
author | stephent |
---|---|
date | Sat, 10 May 2003 07:44:24 +0000 |
parents | 74cb069b8417 |
children | 28ffd53a1d42 |
comparison
equal
deleted
inserted
replaced
1471:0b318c558de8 | 1472:4c87ece1e837 |
---|---|
203 (Assert (string-match range-not string)))) | 203 (Assert (string-match range-not string)))) |
204 (setq i (1+ i)))))) | 204 (setq i (1+ i)))))) |
205 | 205 |
206 ;; (test-regex-charset-mule-paranoid) | 206 ;; (test-regex-charset-mule-paranoid) |
207 | 207 |
208 ;; Test that replace-match errors after a failed match | 208 ;; Test that replace-match does not clobber registers after a failed match |
209 (with-temp-buffer | 209 (with-temp-buffer |
210 (insert "This is a test buffer.") | 210 (insert "This is a test buffer.") |
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 (Check-Error args-out-of-range (replace-match ""))) | 214 (replace-match "") |
215 (Assert (looking-at "^buffer.$"))) | |
215 | 216 |
216 ;; Test that trivial regexps reset unused registers | 217 ;; Test that trivial regexps reset unused registers |
217 ;; Thanks to Martin Sternholm for the report. | 218 ;; Thanks to Martin Sternholm for the report. |
218 ;; xemacs-beta <5blm6h2ki5.fsf@lister.roxen.com> | 219 ;; xemacs-beta <5blm6h2ki5.fsf@lister.roxen.com> |
219 (with-temp-buffer | 220 (with-temp-buffer |
281 | 282 |
282 ;; More stale match data tests. | 283 ;; More stale match data tests. |
283 ;; Thanks to <bjacob@ca.metsci.com>. | 284 ;; Thanks to <bjacob@ca.metsci.com>. |
284 ;; These tests used to fail because we cleared match data only on success. | 285 ;; These tests used to fail because we cleared match data only on success. |
285 ;; Fixed 2003-04-17. | 286 ;; Fixed 2003-04-17. |
286 (Assert (not (progn (string-match "a" "a") | 287 ;; Have to revert 2003-05-09; too much code depends on failed matches |
287 (string-match "b" "a") | 288 ;; preserving match-data. |
288 (match-string 0 "a")))) | 289 ;; string match and regexp match are equivalent |
289 (Assert (not (progn (string-match "a" "a") | 290 (let ((a "a")) |
290 (string-match "b" "a") | 291 (Assert (string= (progn (string-match "a" a) |
291 (match-string 1 "a")))) | 292 (string-match "b" a) |
292 (Assert (not (progn (string-match "\\(a\\)" "a") | 293 (match-string 0 a)) |
293 (string-match "\\(b\\)" "a") | 294 a)) |
294 (match-string 0 "a")))) | 295 (Assert (not (progn (string-match "a" a) |
295 (Assert (not (progn (string-match "\\(a\\)" "a") | 296 (string-match "b" a) |
296 (string-match "\\(b\\)" "a") | 297 (match-string 1 a)))) |
297 (match-string 1 "a")))) | 298 ;; test both for the second match is a plain string match and a regexp match |
299 (Assert (string= (progn (string-match "\\(a\\)" a) | |
300 (string-match "\\(b\\)" a) | |
301 (match-string 0 a)) | |
302 a)) | |
303 (Assert (string= (progn (string-match "\\(a\\)" a) | |
304 (string-match "b" a) | |
305 (match-string 0 a)) | |
306 a)) | |
307 (Assert (string= (progn (string-match "\\(a\\)" a) | |
308 (string-match "\\(b\\)" a) | |
309 (match-string 1 a)) | |
310 a)) | |
311 (Assert (string= (progn (string-match "\\(a\\)" a) | |
312 (string-match "b" a) | |
313 (match-string 1 a)) | |
314 a))) |