1 ;;; textprop-tests.el --- Test suite for text properties.
3 ;; Copyright (C) 2015 Free Software Foundation, Inc.
5 ;; Author: Wolfgang Jenkner <wjenkner@inode.at>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 (ert-deftest textprop-tests-font-lock--remove-face-from-text-property
()
28 "Test `font-lock--remove-face-from-text-property'."
29 (let* ((string "foobar")
31 (faces '(bold (:foreground
"red") underline
)))
32 ;; Build each string in `stack' by adding a face to the previous
34 (let ((faces (reverse faces
)))
35 (push (copy-sequence (car stack
)) stack
)
36 (put-text-property 0 3 'font-lock-face
(pop faces
) (car stack
))
37 (push (copy-sequence (car stack
)) stack
)
38 (put-text-property 3 6 'font-lock-face
(pop faces
) (car stack
))
39 (push (copy-sequence (car stack
)) stack
)
40 (font-lock-prepend-text-property 2 5
41 'font-lock-face
(pop faces
) (car stack
)))
42 ;; Check that removing the corresponding face from each string
43 ;; yields the previous string in `stack'.
45 ;; (message "%S" (car stack))
46 (should (equal-including-properties
48 (font-lock--remove-face-from-text-property 0 6
55 ;; (message "%S" (car stack))
56 (should (and (equal-including-properties (pop stack
) string
)