aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/search-tests.el42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/src/search-tests.el b/test/src/search-tests.el
new file mode 100644
index 00000000000..b7b4ab9a8ff
--- /dev/null
+++ b/test/src/search-tests.el
@@ -0,0 +1,42 @@
1;;; search-tests.el --- tests for search.c functions -*- lexical-binding: t -*-
2
3;; Copyright (C) 2015-2016, 2018-2021 Free Software Foundation, Inc.
4
5;; This file is part of GNU Emacs.
6
7;; GNU Emacs is free software: you can redistribute it and/or modify
8;; it under the terms of the GNU General Public License as published by
9;; the Free Software Foundation, either version 3 of the License, or
10;; (at your option) any later version.
11
12;; GNU Emacs is distributed in the hope that it will be useful,
13;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;; GNU General Public License for more details.
16
17;; You should have received a copy of the GNU General Public License
18;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
19
20;;; Code:
21
22(require 'ert)
23
24(ert-deftest test-replace-match-modification-hooks ()
25 (let ((ov-set nil))
26 (with-temp-buffer
27 (insert "1 abc")
28 (setq ov-set (make-overlay 3 5))
29 (overlay-put
30 ov-set 'modification-hooks
31 (list (lambda (o after &rest _args)
32 (when after
33 (let ((inhibit-modification-hooks t))
34 (save-excursion
35 (goto-char 2)
36 (insert "234")))))))
37 (goto-char 3)
38 (if (search-forward "bc")
39 (replace-match "bcd"))
40 (should (= (point) 10)))))
41
42;;; search-tests.el ends here