unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#36486: [PATCH] Add tests for text-property-search to check prop-match-value
@ 2019-07-03  9:44 Stefan Kangas
  2019-07-06 14:25 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Kangas @ 2019-07-03  9:44 UTC (permalink / raw)
  To: 36486

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]

Attached is a patch with additional test cases for
text-property-search which checks the returned match object.  Unlike
older test cases, these also check the value of prop-match-value.

Thanks,
Stefan Kangas

[-- Attachment #2: 0001-Add-tests-for-text-property-search-to-check-prop-mat.patch --]
[-- Type: application/octet-stream, Size: 2763 bytes --]

From d86382bb256bbb3808351666764cb127647016d2 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <stefankangas@gmail.com>
Date: Mon, 1 Jul 2019 23:14:56 +0200
Subject: [PATCH] Add tests for text-property-search to check prop-match-value

* test/lisp/emacs-lisp/text-property-search-tests.el
(with-match-test): New macro.
(text-property-search-forward-prop-match-match-face-nil-nil)
(text-property-search-forward-prop-match-match-face-bold-t)
(text-property-search-forward-prop-match-match-face-bold-nil)
(text-property-search-backward-prop-match-match-face-nil-nil)
(text-property-search-backward-prop-match-match-face-italic-t)
(text-property-search-backward-prop-match-match-face-italic-nil):
Add test cases to also verify the value of prop-match-value.
---
 .../emacs-lisp/text-property-search-tests.el  | 43 +++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el b/test/lisp/emacs-lisp/text-property-search-tests.el
index 47db54a051..21a25c7835 100644
--- a/test/lisp/emacs-lisp/text-property-search-tests.el
+++ b/test/lisp/emacs-lisp/text-property-search-tests.el
@@ -108,6 +108,49 @@ text-property-search-backward-partial-non-current-bold-t
              '("bold1")
              35))
 
+(defmacro with-match-test (form beginning end value &optional point)
+  `(with-temp-buffer
+     (text-property-setup)
+     (when ,point
+       (goto-char ,point))
+     (should (equal ,form
+                    (make-prop-match :beginning ,beginning
+                                     :end ,end
+                                     :value ,value)))))
+
+(ert-deftest text-property-search-forward-prop-match-match-face-nil-nil ()
+  (with-match-test
+   (text-property-search-forward 'face nil nil)
+   9 14 'bold))
+
+(ert-deftest text-property-search-forward-prop-match-match-face-bold-t ()
+  (with-match-test
+   (text-property-search-forward 'face 'bold t)
+   9 14 'bold))
+
+(ert-deftest text-property-search-forward-prop-match-match-face-bold-nil ()
+  (with-match-test
+   (text-property-search-forward 'face 'bold nil)
+   1 9 nil))
+
+(ert-deftest text-property-search-backward-prop-match-match-face-nil-nil ()
+  (with-match-test
+   (text-property-search-backward 'face nil nil)
+   39 46 'italic
+   (point-max)))
+
+(ert-deftest text-property-search-backward-prop-match-match-face-italic-t ()
+  (with-match-test
+   (text-property-search-backward 'face 'italic t)
+   39 46 'italic
+   (point-max)))
+
+(ert-deftest text-property-search-backward-prop-match-match-face-italic-nil ()
+  (with-match-test
+   (text-property-search-backward 'face 'italic nil)
+   46 57 nil
+   (point-max)))
+
 (provide 'text-property-search-tests)
 
 ;;; text-property-search-tests.el ends here
-- 
2.21.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-07-12 23:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-03  9:44 bug#36486: [PATCH] Add tests for text-property-search to check prop-match-value Stefan Kangas
2019-07-06 14:25 ` Lars Ingebrigtsen
2019-07-07 22:59   ` Juri Linkov
2019-07-08 16:18     ` Lars Ingebrigtsen
2019-07-08 20:51       ` Juri Linkov
2019-07-08 21:54         ` Lars Ingebrigtsen
2019-07-09 20:31           ` Juri Linkov
2019-07-09 21:52             ` Lars Ingebrigtsen
2019-07-10 22:29               ` Juri Linkov
2019-07-11 14:17                 ` Lars Ingebrigtsen
2019-07-11 22:08                   ` Juri Linkov
2019-07-12 14:37                     ` Lars Ingebrigtsen
2019-07-12 18:47                       ` Juri Linkov
2019-07-12 23:40                         ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).