From: Stefan Kangas Date: Mon, 9 Nov 2020 20:43:53 +0000 (+0100) Subject: Add test for substitute-command-keys with command remap X-Git-Tag: emacs-28.0.90~5201 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=8ece715af613d238a86092abf62db57ded6c55b3;p=emacs.git Add test for substitute-command-keys with command remap * test/lisp/help-tests.el (help-tests-remap-map): New variable. (help-tests-substitute-command-keys/remap): New test. (help-tests-substitute-command-keys/keymaps) (help-tests-substitute-command-keys/undefined-map): Fix indentation. --- diff --git a/test/lisp/help-tests.el b/test/lisp/help-tests.el index b6dffb2a405..42be0296c4f 100644 --- a/test/lisp/help-tests.el +++ b/test/lisp/help-tests.el @@ -91,7 +91,7 @@ (ert-deftest help-tests-substitute-command-keys/keymaps () (with-substitute-command-keys-test (test "\\{minibuffer-local-must-match-map}" - "\ + "\ key binding --- ------- @@ -125,10 +125,21 @@ M-s next-matching-history-element (test "\\\\[abort-recursive-edit]" "C-g") (test "\\\\[eval-defun]" "C-M-x"))) +(defvar help-tests-remap-map + (let ((map (make-keymap))) + (define-key map (kbd "x") 'foo) + (define-key map (kbd "y") 'bar) + (define-key map [remap foo] 'bar) + map)) + +(ert-deftest help-tests-substitute-command-keys/remap () + (should (equal (substitute-command-keys "\\\\[foo]") "y")) + (should (equal (substitute-command-keys "\\\\[bar]") "y"))) + (ert-deftest help-tests-substitute-command-keys/undefined-map () (with-substitute-command-keys-test (test-re "\\{foobar-map}" - "\nUses keymap [`'‘]foobar-map['’], which is not currently defined.\n"))) + "\nUses keymap [`'‘]foobar-map['’], which is not currently defined.\n"))) (ert-deftest help-tests-substitute-command-keys/quotes () (with-substitute-command-keys-test