emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 6e5186e: * test/automated/keymaps-test.el: Fix test


From: Juanma Barranquero
Subject: [Emacs-diffs] master 6e5186e: * test/automated/keymaps-test.el: Fix test to make it repeatable
Date: Thu, 12 Nov 2015 22:42:54 +0000

branch: master
commit 6e5186e8a7ccfb9b8fb35b5f4f0371e4f4a68162
Author: Juanma Barranquero <address@hidden>
Commit: Juanma Barranquero <address@hidden>

    * test/automated/keymaps-test.el: Fix test to make it repeatable
    
    (keymap-store_in_keymap-FASTINT-on-nonchars): Reset Buffer-menu-mode-map
    entry to its initial value to make the test repeatable in interactive
    sessions (assuming it doesn't fail and crashes Emacs, of course).
---
 test/automated/keymap-tests.el |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/test/automated/keymap-tests.el b/test/automated/keymap-tests.el
index 482ed27..973b240 100644
--- a/test/automated/keymap-tests.el
+++ b/test/automated/keymap-tests.el
@@ -26,13 +26,17 @@
 (ert-deftest keymap-store_in_keymap-FASTINT-on-nonchars ()
   "Check for bug fixed in \"Fix assertion violation in define-key\",
 commit 86c19714b097aa477d339ed99ffb5136c755a046."
-  (should-not (eq (lookup-key Buffer-menu-mode-map [32]) 'undefined))
-  ;; This will cause an assertion violation if the bug is present.
-  ;; We could run an inferior Emacs process and check for the return
-  ;; status, but in some environments an assertion failure triggers
-  ;; an abort dialog that requires user intervention anyway.
-  (define-key Buffer-menu-mode-map [(32 . 126)] 'undefined)
-  (should (eq (lookup-key Buffer-menu-mode-map [32]) 'undefined)))
+  (let ((def (lookup-key Buffer-menu-mode-map [32])))
+    (unwind-protect
+        (progn
+          (should-not (eq def 'undefined))
+          ;; This will cause an assertion violation if the bug is present.
+          ;; We could run an inferior Emacs process and check for the return
+          ;; status, but in some environments an assertion failure triggers
+          ;; an abort dialog that requires user intervention anyway.
+          (define-key Buffer-menu-mode-map [(32 . 32)] 'undefined)
+          (should (eq (lookup-key Buffer-menu-mode-map [32]) 'undefined)))
+      (define-key Buffer-menu-mode-map [32] def))))
 
 (provide 'keymap-tests)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]