1 ;;; doc-tests.el --- Tests for doc.c
3 ;; Copyright (C) 2016-2017 Free Software Foundation, Inc.
5 ;; Author: Eli Zaretskii <eliz@gnu.org>
7 ;; This program is free software; you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
24 (ert-deftest doc-test-substitute-command-keys
()
26 (should (string= (substitute-command-keys "foo \\[goto-char]") "foo M-g c"))
27 ;; Cannot use string= here, as that compares unibyte and multibyte
29 (should (compare-strings
30 (substitute-command-keys "\200 \\[goto-char]") nil nil
31 "\200 M-g c" nil nil
))
33 (should (string= (substitute-command-keys "foo \\=\\[goto-char]")
35 (should (string= (substitute-command-keys "foo \\=\\=")
38 (should (string= (substitute-command-keys
39 "\\{minibuffer-local-must-match-map}")
44 C-g abort-recursive-edit
45 TAB minibuffer-complete
46 C-j minibuffer-complete-and-exit
47 RET minibuffer-complete-and-exit
49 SPC minibuffer-complete-word
50 ? minibuffer-completion-help
51 <C-tab> file-cache-minibuffer-complete
52 <XF86Back> previous-history-element
53 <XF86Forward> next-history-element
54 <down> next-line-or-history-element
55 <next> next-history-element
56 <prior> switch-to-completions
57 <up> previous-line-or-history-element
59 M-v switch-to-completions
61 M-n next-history-element
62 M-p previous-history-element
63 M-r previous-matching-history-element
64 M-s next-matching-history-element
68 (substitute-command-keys
69 "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]")
71 ;; Allow any style of quotes, since the terminal might not support
74 "\nUses keymap [`‘']foobar-map['’], which is not currently defined.\n"
75 (substitute-command-keys "\\{foobar-map}")))
77 (should (let ((text-quoting-style 'grave
))
78 (string= (substitute-command-keys "quotes `like this'")
79 "quotes `like this'")))
80 (should (let ((text-quoting-style 'grave
))
81 (string= (substitute-command-keys "quotes ‘like this’")
82 "quotes ‘like this’")))
83 (should (let ((text-quoting-style 'straight
))
84 (string= (substitute-command-keys "quotes `like this'")
85 "quotes 'like this'")))
87 (should (string= (substitute-command-keys "\\[foobar") "\\[foobar"))
88 (should (string= (substitute-command-keys "\\=") "\\="))
92 ;;; doc-tests.el ends here