From: Stefan Kangas <stefan@marxist.se>
To: 36486@debbugs.gnu.org
Subject: bug#36486: [PATCH] Add tests for text-property-search to check prop-match-value
Date: Wed, 3 Jul 2019 11:44:09 +0200 [thread overview]
Message-ID: <CADwFkm=ZN+xOFdLLPR6ueACHYBES77WCk90Q5vunGFqEcVFPWQ@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2019-07-03 9:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-03 9:44 Stefan Kangas [this message]
2019-07-06 14:25 ` bug#36486: [PATCH] Add tests for text-property-search to check prop-match-value 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADwFkm=ZN+xOFdLLPR6ueACHYBES77WCk90Q5vunGFqEcVFPWQ@mail.gmail.com' \
--to=stefan@marxist.se \
--cc=36486@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).