1 ;;; hi-lock-tests.el --- Tests for hi-lock.el -*- lexical-binding: t; -*-
3 ;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
5 ;; Author: Tino Calancha <tino.calancha@gmail.com>
8 ;; This program is free software; you can redistribute it and/or modify
9 ;; it under the terms of the GNU General Public License as published by
10 ;; the Free Software Foundation, either version 3 of the License, or
11 ;; (at your option) any later version.
13 ;; This program is distributed in the hope that it will be useful,
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;; GNU General Public License for more details.
18 ;; You should have received a copy of the GNU General Public License
19 ;; along with this program. If not, see <https://www.gnu.org/licenses/>.
26 (ert-deftest hi-lock-bug26666
()
27 "Test for https://debbugs.gnu.org/26666 ."
28 (let ((faces hi-lock-face-defaults
))
31 (cl-letf (((symbol-function 'completing-read
)
32 (lambda (_prompt _coll _x _y _z _hist defaults
)
35 (let ((face (hi-lock-read-face-name)))
36 (hi-lock-set-pattern "a" face
))))
37 (should (equal hi-lock--unused-faces
(cdr faces
))))))
39 (ert-deftest hi-lock-test-set-pattern
()
40 (let ((faces hi-lock-face-defaults
))
43 (cl-letf (((symbol-function 'completing-read
)
44 (lambda (_prompt _coll _x _y _z _hist defaults
)
46 (hi-lock-set-pattern "9999" (hi-lock-read-face-name)) ; No match
47 (hi-lock-set-pattern "foo" (hi-lock-read-face-name)))
48 ;; Only one match, then we have used just 1 face
49 (should (equal hi-lock--unused-faces
(cdr faces
))))))
51 (provide 'hi-lock-tests
)
52 ;;; hi-lock-tests.el ends here