1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
| | ;;; font-core.el --- ERT tests for font-core.el -*- lexical-binding: t -*-
;; Copyright (C) 2015 Free Software Foundation, Inc.
;; Author: Michal Nazarewicz <mina86@mina86.com>
;; Keywords: languages, faces
;; Package: emacs
;; This file is part of GNU Emacs.
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; This package defines regression tests for the font-core package.
;;; Code:
(require 'ert)
(require 'font-core)
(defun font-lock-test-global-modes (func expected-pairs)
(dolist (pair expected-pairs)
(let ((font-lock-global-modes (car pair)))
(funcall func 'foo-mode)
(should (equal (cdr pair) font-lock-global-modes)))))
(ert-deftest font-lock-test-disable-global-for ()
"Test `font-lock-disable-global-for' function"
(font-lock-test-global-modes 'font-lock-disable-global-for
'((nil . nil)
(t . (not foo-mode))
((not bar-mode) . (not foo-mode bar-mode))
((not foo-mode) . (not foo-mode))
((foo-mode) . nil)
((foo-mode bar-mode) . (bar-mode)))))
(ert-deftest font-lock-test-enable-global-for ()
"Test `font-lock-enable-global-for' function"
(font-lock-test-global-modes 'font-lock-enable-global-for
'((nil . (foo-mode))
(t . t)
((not bar-mode) . (not bar-mode))
((not foo-mode bar-mode) . (not bar-mode))
((not foo-mode) . t)
((foo-mode) . (foo-mode))
((bar-mode) . (foo-mode bar-mode)))))
(provide 'font-core-tests)
;;; font-core.el ends here
|