diff options
| author | Glenn Morris | 2019-08-20 09:04:53 -0700 |
|---|---|---|
| committer | Glenn Morris | 2019-08-20 09:04:53 -0700 |
| commit | af103ef3c9d6df07475e2b3a2f846246d7fd2a8b (patch) | |
| tree | a7e0a0cb7db56b68b8b3a0c3c29a6b90d61edff7 /test/lisp/replace-tests.el | |
| parent | 989c85e799b7c3a425d3d03f98ecd55d5cf76022 (diff) | |
| parent | 615cff42580a3521c1a4ea7c3ec467eb8259e1c7 (diff) | |
| download | emacs-af103ef3c9d6df07475e2b3a2f846246d7fd2a8b.tar.gz emacs-af103ef3c9d6df07475e2b3a2f846246d7fd2a8b.zip | |
Merge from origin/emacs-26
615cff4 (origin/emacs-26) Fix process filter documentation (Bug#13400)
beb1d22 Fix query-replace-regexp undo feature
# Conflicts:
# test/lisp/replace-tests.el
Diffstat (limited to 'test/lisp/replace-tests.el')
| -rw-r--r-- | test/lisp/replace-tests.el | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/test/lisp/replace-tests.el b/test/lisp/replace-tests.el index c908d4e2a71..f7bf2d93658 100644 --- a/test/lisp/replace-tests.el +++ b/test/lisp/replace-tests.el | |||
| @@ -411,6 +411,9 @@ Each element has the format: | |||
| 411 | (defvar replace-tests-bind-read-string nil | 411 | (defvar replace-tests-bind-read-string nil |
| 412 | "A string to bind `read-string' and avoid the prompt.") | 412 | "A string to bind `read-string' and avoid the prompt.") |
| 413 | 413 | ||
| 414 | (defvar replace-tests-perform-replace-regexp-flag t | ||
| 415 | "Value for regexp-flag argument passed to `perform-replace' in undo tests.") | ||
| 416 | |||
| 414 | (defmacro replace-tests-with-undo (input from to char-nums def-chr &rest body) | 417 | (defmacro replace-tests-with-undo (input from to char-nums def-chr &rest body) |
| 415 | "Helper to test `query-replace' undo feature. | 418 | "Helper to test `query-replace' undo feature. |
| 416 | INPUT is a string to insert in a temporary buffer. | 419 | INPUT is a string to insert in a temporary buffer. |
| @@ -463,7 +466,7 @@ Return the last evalled form in BODY." | |||
| 463 | ((symbol-function 'replace-highlight) | 466 | ((symbol-function 'replace-highlight) |
| 464 | (lambda (&rest _args) | 467 | (lambda (&rest _args) |
| 465 | (string-match "[A-Z ]" "ForestGreen")))) | 468 | (string-match "[A-Z ]" "ForestGreen")))) |
| 466 | (perform-replace ,from ,to t t nil)) | 469 | (perform-replace ,from ,to t replace-tests-perform-replace-regexp-flag nil)) |
| 467 | ,@body)))) | 470 | ,@body)))) |
| 468 | 471 | ||
| 469 | (defun replace-tests--query-replace-undo (&optional comma) | 472 | (defun replace-tests--query-replace-undo (&optional comma) |
| @@ -505,4 +508,26 @@ Return the last evalled form in BODY." | |||
| 505 | input "a" "B" ((?\s . (1 2 3)) (?E . (4)) (?U . (5))) ?q | 508 | input "a" "B" ((?\s . (1 2 3)) (?E . (4)) (?U . (5))) ?q |
| 506 | (string= input (buffer-string)))))) | 509 | (string= input (buffer-string)))))) |
| 507 | 510 | ||
| 511 | (ert-deftest query-replace-undo-bug37073 () | ||
| 512 | "Test for https://debbugs.gnu.org/37073 ." | ||
| 513 | (let ((input "theorem 1\ntheorem 2\ntheorem 3")) | ||
| 514 | (should | ||
| 515 | (replace-tests-with-undo | ||
| 516 | input "theorem \\([0-9]+\\)" | ||
| 517 | "theorem \\\\ref{theo_\\1}" | ||
| 518 | ((?\s . (1 2)) (?U . (3))) | ||
| 519 | ?q | ||
| 520 | (string= input (buffer-string))))) | ||
| 521 | ;; Now run a test with regexp-flag arg in `perform-replace' set to nil | ||
| 522 | (let ((input " ^theorem$ 1\n ^theorem$ 2\n ^theorem$ 3") | ||
| 523 | (replace-tests-perform-replace-regexp-flag nil) | ||
| 524 | (expected " theo 1\n ^theorem$ 2\n ^theorem$ 3")) | ||
| 525 | (should | ||
| 526 | (replace-tests-with-undo | ||
| 527 | input "^theorem$" | ||
| 528 | "theo" | ||
| 529 | ((?\s . (1 2 4)) (?U . (3))) | ||
| 530 | ?q | ||
| 531 | (string= expected (buffer-string)))))) | ||
| 532 | |||
| 508 | ;;; replace-tests.el ends here | 533 | ;;; replace-tests.el ends here |