diff options
| author | Stefan Kangas | 2019-07-08 18:37:50 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-10-18 17:23:24 +0200 |
| commit | dcf9cd47ae71e39eb616d77acb531ac11357391f (patch) | |
| tree | b677b2916ad50bfe3932829396436154cfbb0ce6 /test/src | |
| parent | 282f35083c02ace9b287dc311bef1d16721e6c0c (diff) | |
| download | emacs-dcf9cd47ae71e39eb616d77acb531ac11357391f.tar.gz emacs-dcf9cd47ae71e39eb616d77acb531ac11357391f.zip | |
Add new Lisp implementation of substitute-command-keys
This is only the first step towards a full Lisp implementation, and
does not remove the old C code. On the contrary, it is partly based
on using the old C code, which is to be replaced in steps. This also
makes it easy to test that it produces the same output as the old.
* src/doc.c (Fsubstitute_command_keys_old): Rename from
Fsubstitute_command_keys.
(Fget_quoting_style): New defun to expose text_quoting_style to Lisp.
(syms_of_doc): Expose above symbols.
* lisp/help.el (substitute-command-keys): New Lisp version of
substitute-command-keys. (Bug#8951)
* src/keymap.c
(Fdescribe_map_tree): New defun to expose describe_map_tree to Lisp.
(syms_of_keymap): New defsubr for Fdescribe_map_tree.
* src/keyboard.c (help_echo_substitute_command_keys):
* src/doc.c (Fdocumentation, Fdocumentation_property):
* src/print.c (print_error_message):
* src/syntax.c (Finternal_describe_syntax_value): Fix calls to use new
Lisp implementation of substitute-command-keys.
* test/src/doc-tests.el: Remove file.
* test/lisp/help-tests.el: Add tests for substitute-command-keys
copied from above file.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/doc-tests.el | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el deleted file mode 100644 index 797b9ba5480..00000000000 --- a/test/src/doc-tests.el +++ /dev/null | |||
| @@ -1,98 +0,0 @@ | |||
| 1 | ;;; doc-tests.el --- Tests for doc.c -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2016-2020 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> | ||
| 6 | |||
| 7 | ;; This file is part of GNU Emacs. | ||
| 8 | |||
| 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. | ||
| 13 | |||
| 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. | ||
| 18 | |||
| 19 | ;; You should have received a copy of the GNU General Public License | ||
| 20 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Code: | ||
| 23 | |||
| 24 | (require 'ert) | ||
| 25 | |||
| 26 | (ert-deftest doc-test-substitute-command-keys () | ||
| 27 | ;; Bindings. | ||
| 28 | (should (string= (substitute-command-keys "foo \\[goto-char]") "foo M-g c")) | ||
| 29 | ;; Cannot use string= here, as that compares unibyte and multibyte | ||
| 30 | ;; strings not equal. | ||
| 31 | (should (compare-strings | ||
| 32 | (substitute-command-keys "\200 \\[goto-char]") nil nil | ||
| 33 | "\200 M-g c" nil nil)) | ||
| 34 | ;; Literals. | ||
| 35 | (should (string= (substitute-command-keys "foo \\=\\[goto-char]") | ||
| 36 | "foo \\[goto-char]")) | ||
| 37 | (should (string= (substitute-command-keys "foo \\=\\=") | ||
| 38 | "foo \\=")) | ||
| 39 | ;; Keymaps. | ||
| 40 | ;; I don't see that this is testing anything useful. | ||
| 41 | ;; AFAICS all it does it fail whenever someone modifies the | ||
| 42 | ;; minibuffer map. | ||
| 43 | ;;; (should (string= (substitute-command-keys | ||
| 44 | ;;; "\\{minibuffer-local-must-match-map}") | ||
| 45 | ;;; "\ | ||
| 46 | ;;; key binding | ||
| 47 | ;;; --- ------- | ||
| 48 | ;;; | ||
| 49 | ;;; C-g abort-recursive-edit | ||
| 50 | ;;; TAB minibuffer-complete | ||
| 51 | ;;; C-j minibuffer-complete-and-exit | ||
| 52 | ;;; RET minibuffer-complete-and-exit | ||
| 53 | ;;; ESC Prefix Command | ||
| 54 | ;;; SPC minibuffer-complete-word | ||
| 55 | ;;; ? minibuffer-completion-help | ||
| 56 | ;;; <C-tab> file-cache-minibuffer-complete | ||
| 57 | ;;; <XF86Back> previous-history-element | ||
| 58 | ;;; <XF86Forward> next-history-element | ||
| 59 | ;;; <down> next-line-or-history-element | ||
| 60 | ;;; <next> next-history-element | ||
| 61 | ;;; <prior> switch-to-completions | ||
| 62 | ;;; <up> previous-line-or-history-element | ||
| 63 | ;;; | ||
| 64 | ;;; M-v switch-to-completions | ||
| 65 | ;;; | ||
| 66 | ;;; M-< minibuffer-beginning-of-buffer | ||
| 67 | ;;; M-n next-history-element | ||
| 68 | ;;; M-p previous-history-element | ||
| 69 | ;;; M-r previous-matching-history-element | ||
| 70 | ;;; M-s next-matching-history-element | ||
| 71 | ;;; | ||
| 72 | ;;; ")) | ||
| 73 | (should (string= | ||
| 74 | (substitute-command-keys | ||
| 75 | "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]") | ||
| 76 | "C-g")) | ||
| 77 | ;; Allow any style of quotes, since the terminal might not support | ||
| 78 | ;; UTF-8. | ||
| 79 | (should (string-match | ||
| 80 | "\nUses keymap [`‘']foobar-map['’], which is not currently defined.\n" | ||
| 81 | (substitute-command-keys "\\{foobar-map}"))) | ||
| 82 | ;; Quotes. | ||
| 83 | (should (let ((text-quoting-style 'grave)) | ||
| 84 | (string= (substitute-command-keys "quotes `like this'") | ||
| 85 | "quotes `like this'"))) | ||
| 86 | (should (let ((text-quoting-style 'grave)) | ||
| 87 | (string= (substitute-command-keys "quotes ‘like this’") | ||
| 88 | "quotes ‘like this’"))) | ||
| 89 | (should (let ((text-quoting-style 'straight)) | ||
| 90 | (string= (substitute-command-keys "quotes `like this'") | ||
| 91 | "quotes 'like this'"))) | ||
| 92 | ;; Bugs. | ||
| 93 | (should (string= (substitute-command-keys "\\[foobar") "\\[foobar")) | ||
| 94 | (should (string= (substitute-command-keys "\\=") "\\=")) | ||
| 95 | ) | ||
| 96 | |||
| 97 | (provide 'doc-tests) | ||
| 98 | ;;; doc-tests.el ends here | ||