From 810de9a4b066c62b0af4f8d9f452a5adde824aa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 24 Dec 2012 01:45:59 +0000 Subject: [PATCH] Add: unit test for YAS-MINOR-MODE-MAP rebindings --- yasnippet-tests.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/yasnippet-tests.el b/yasnippet-tests.el index 783eb38..e8c4a11 100644 --- a/yasnippet-tests.el +++ b/yasnippet-tests.el @@ -462,6 +462,21 @@ TODO: be meaner" (should (eq (key-binding [(shift tab)]) 'yas-prev-field)) (should (eq (key-binding [backtab]) 'yas-prev-field)))) +(ert-deftest test-rebindings () + (unwind-protect + (progn + (define-key yas-minor-mode-map [tab] nil) + (define-key yas-minor-mode-map (kbd "TAB") nil) + (define-key yas-minor-mode-map (kbd "SPC") 'yas-expand) + (with-temp-buffer + (yas-minor-mode 1) + (should (not (eq (key-binding (yas--read-keybinding "TAB")) 'yas-expand))) + (should (eq (key-binding (yas--read-keybinding "SPC")) 'yas-expand)) + (yas-reload-all) + (should (not (eq (key-binding (yas--read-keybinding "TAB")) 'yas-expand))) + (should (eq (key-binding (yas--read-keybinding "SPC")) 'yas-expand)))) + (setcdr yas-minor-mode-map (cdr (yas--init-minor-keymap))))) + (ert-deftest test-yas-in-org () (with-temp-buffer (org-mode)