Avoid leaving garbage on screen when using 'raise' display property
[emacs.git] / test / src / keymap-tests.el
blobc5b9d0cc71c7ad9f4627d0d7045b320b91d0ccf7
1 ;;; keymap-tests.el --- Test suite for src/keymap.c
3 ;; Copyright (C) 2015-2017 Free Software Foundation, Inc.
5 ;; Author: Juanma Barranquero <lekktu@gmail.com>
7 ;; This file is part of GNU Emacs.
9 ;; GNU Emacs is free software: you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation, either version 3 of the License, or
12 ;; (at your option) any later version.
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
22 ;;; Code:
24 (require 'ert)
26 (ert-deftest keymap-store_in_keymap-XFASTINT-on-non-characters ()
27 "Check for bug fixed in \"Fix assertion violation in define-key\",
28 commit 86c19714b097aa477d339ed99ffb5136c755a046."
29 (let ((def (lookup-key Buffer-menu-mode-map [32])))
30 (unwind-protect
31 (progn
32 (should-not (eq def 'undefined))
33 ;; This will cause an assertion violation if the bug is present.
34 ;; We could run an inferior Emacs process and check for the return
35 ;; status, but in some environments an assertion failure triggers
36 ;; an abort dialog that requires user intervention anyway.
37 (define-key Buffer-menu-mode-map [(32 . 32)] 'undefined)
38 (should (eq (lookup-key Buffer-menu-mode-map [32]) 'undefined)))
39 (define-key Buffer-menu-mode-map [32] def))))
41 (ert-deftest keymap-where-is-internal-test ()
42 "Make sure we don't crash when `where-is-preferred-modifier' is not a symbol."
43 (should
44 (equal (let ((where-is-preferred-modifier "alt"))
45 (where-is-internal 'execute-extended-command global-map t))
46 [#x8000078])))
48 (provide 'keymap-tests)
50 ;;; keymap-tests.el ends here