diff options
| author | Stefan Kangas | 2019-07-06 16:27:05 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2019-07-06 16:27:05 +0200 |
| commit | cfcaf06fe5846672f59968449c8653a3e9dcba5b (patch) | |
| tree | a45e799b9db928003bee4cad4094111a91d2928e | |
| parent | 3cb166ad268244f253a0bf3dd180ab871d1bed55 (diff) | |
| download | emacs-cfcaf06fe5846672f59968449c8653a3e9dcba5b.tar.gz emacs-cfcaf06fe5846672f59968449c8653a3e9dcba5b.zip | |
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
(bug#36486).
| -rw-r--r-- | test/lisp/emacs-lisp/text-property-search-tests.el | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/text-property-search-tests.el b/test/lisp/emacs-lisp/text-property-search-tests.el index 47db54a0512..21a25c7835f 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 @@ | |||
| 108 | '("bold1") | 108 | '("bold1") |
| 109 | 35)) | 109 | 35)) |
| 110 | 110 | ||
| 111 | (defmacro with-match-test (form beginning end value &optional point) | ||
| 112 | `(with-temp-buffer | ||
| 113 | (text-property-setup) | ||
| 114 | (when ,point | ||
| 115 | (goto-char ,point)) | ||
| 116 | (should (equal ,form | ||
| 117 | (make-prop-match :beginning ,beginning | ||
| 118 | :end ,end | ||
| 119 | :value ,value))))) | ||
| 120 | |||
| 121 | (ert-deftest text-property-search-forward-prop-match-match-face-nil-nil () | ||
| 122 | (with-match-test | ||
| 123 | (text-property-search-forward 'face nil nil) | ||
| 124 | 9 14 'bold)) | ||
| 125 | |||
| 126 | (ert-deftest text-property-search-forward-prop-match-match-face-bold-t () | ||
| 127 | (with-match-test | ||
| 128 | (text-property-search-forward 'face 'bold t) | ||
| 129 | 9 14 'bold)) | ||
| 130 | |||
| 131 | (ert-deftest text-property-search-forward-prop-match-match-face-bold-nil () | ||
| 132 | (with-match-test | ||
| 133 | (text-property-search-forward 'face 'bold nil) | ||
| 134 | 1 9 nil)) | ||
| 135 | |||
| 136 | (ert-deftest text-property-search-backward-prop-match-match-face-nil-nil () | ||
| 137 | (with-match-test | ||
| 138 | (text-property-search-backward 'face nil nil) | ||
| 139 | 39 46 'italic | ||
| 140 | (point-max))) | ||
| 141 | |||
| 142 | (ert-deftest text-property-search-backward-prop-match-match-face-italic-t () | ||
| 143 | (with-match-test | ||
| 144 | (text-property-search-backward 'face 'italic t) | ||
| 145 | 39 46 'italic | ||
| 146 | (point-max))) | ||
| 147 | |||
| 148 | (ert-deftest text-property-search-backward-prop-match-match-face-italic-nil () | ||
| 149 | (with-match-test | ||
| 150 | (text-property-search-backward 'face 'italic nil) | ||
| 151 | 46 57 nil | ||
| 152 | (point-max))) | ||
| 153 | |||
| 111 | (provide 'text-property-search-tests) | 154 | (provide 'text-property-search-tests) |
| 112 | 155 | ||
| 113 | ;;; text-property-search-tests.el ends here | 156 | ;;; text-property-search-tests.el ends here |