Mercurial > hg > xemacs-beta
changeset 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 | 0b318c558de8 |
children | 1fcb2428fee7 |
files | tests/ChangeLog tests/automated/regexp-tests.el |
diffstat | 2 files changed, 37 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/tests/ChangeLog Sat May 10 04:18:52 2003 +0000 +++ b/tests/ChangeLog Sat May 10 07:44:24 2003 +0000 @@ -1,3 +1,9 @@ +2003-05-09 Stephen J. Turnbull <stephen@xemacs.org> + + * automated/regexp-tests.el (replace-match): Revert test to Assert + that registers are preserved on a failed match. + (stale match data): Test for preserve-on-failure behavior. + 2003-04-24 Steve Youngs <youngs@xemacs.org> * XEmacs 21.5.12 "carrot" is released.
--- a/tests/automated/regexp-tests.el Sat May 10 04:18:52 2003 +0000 +++ b/tests/automated/regexp-tests.el Sat May 10 07:44:24 2003 +0000 @@ -205,13 +205,14 @@ ;; (test-regex-charset-mule-paranoid) -;; Test that replace-match errors after a failed match +;; Test that replace-match does not clobber registers after a failed match (with-temp-buffer (insert "This is a test buffer.") (goto-char (point-min)) (search-forward "this is a test ") (looking-at "Unmatchable text") - (Check-Error args-out-of-range (replace-match ""))) + (replace-match "") + (Assert (looking-at "^buffer.$"))) ;; Test that trivial regexps reset unused registers ;; Thanks to Martin Sternholm for the report. @@ -283,15 +284,31 @@ ;; Thanks to <bjacob@ca.metsci.com>. ;; These tests used to fail because we cleared match data only on success. ;; Fixed 2003-04-17. -(Assert (not (progn (string-match "a" "a") - (string-match "b" "a") - (match-string 0 "a")))) -(Assert (not (progn (string-match "a" "a") - (string-match "b" "a") - (match-string 1 "a")))) -(Assert (not (progn (string-match "\\(a\\)" "a") - (string-match "\\(b\\)" "a") - (match-string 0 "a")))) -(Assert (not (progn (string-match "\\(a\\)" "a") - (string-match "\\(b\\)" "a") - (match-string 1 "a")))) +;; Have to revert 2003-05-09; too much code depends on failed matches +;; preserving match-data. +;; string match and regexp match are equivalent +(let ((a "a")) + (Assert (string= (progn (string-match "a" a) + (string-match "b" a) + (match-string 0 a)) + a)) + (Assert (not (progn (string-match "a" a) + (string-match "b" a) + (match-string 1 a)))) + ;; test both for the second match is a plain string match and a regexp match + (Assert (string= (progn (string-match "\\(a\\)" a) + (string-match "\\(b\\)" a) + (match-string 0 a)) + a)) + (Assert (string= (progn (string-match "\\(a\\)" a) + (string-match "b" a) + (match-string 0 a)) + a)) + (Assert (string= (progn (string-match "\\(a\\)" a) + (string-match "\\(b\\)" a) + (match-string 1 a)) + a)) + (Assert (string= (progn (string-match "\\(a\\)" a) + (string-match "b" a) + (match-string 1 a)) + a)))