diff options
| author | Eli Zaretskii | 2016-08-18 18:06:33 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2016-08-18 18:06:33 +0300 |
| commit | b305fab44c10488e601096d506a30259961e8d7f (patch) | |
| tree | 550041ca86302f8f21f668087fd4a208bb3e8b44 /test/src | |
| parent | 45522a1ed316ea639bee563e7ad91060b921dbfa (diff) | |
| download | emacs-b305fab44c10488e601096d506a30259961e8d7f.tar.gz emacs-b305fab44c10488e601096d506a30259961e8d7f.zip | |
Add tests for 'substitute-command-keys'
* test/src/doc-tests.el (doc-test-substitute-command-keys): New
tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/doc-tests.el | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/test/src/doc-tests.el b/test/src/doc-tests.el new file mode 100644 index 00000000000..be490545747 --- /dev/null +++ b/test/src/doc-tests.el | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | ;;; doc-tests.el --- Tests for doc.c | ||
| 2 | |||
| 3 | ;; Copyright (C) 2016 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Eli Zaretskii <eliz@gnu.org> | ||
| 6 | |||
| 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. | ||
| 11 | |||
| 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. | ||
| 16 | |||
| 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/>. | ||
| 19 | |||
| 20 | ;;; Code: | ||
| 21 | |||
| 22 | (require 'ert) | ||
| 23 | |||
| 24 | (ert-deftest doc-test-substitute-command-keys () | ||
| 25 | ;; Bindings. | ||
| 26 | (should (string= (substitute-command-keys "foo \\[goto-char]") "foo M-g c")) | ||
| 27 | ;; Cannot use string= here, as that compares unibyte and multibyte | ||
| 28 | ;; strings not equal. | ||
| 29 | (should (compare-strings | ||
| 30 | (substitute-command-keys "\200 \\[goto-char]") nil nil | ||
| 31 | "\200 M-g c" nil nil)) | ||
| 32 | ;; Literals. | ||
| 33 | (should (string= (substitute-command-keys "foo \\=\\[goto-char]") | ||
| 34 | "foo \\[goto-char]")) | ||
| 35 | (should (string= (substitute-command-keys "foo \\=\\=") | ||
| 36 | "foo \\=")) | ||
| 37 | ;; Keymaps. | ||
| 38 | (should (string= (substitute-command-keys | ||
| 39 | "\\{minibuffer-local-must-match-map}") | ||
| 40 | "\ | ||
| 41 | key binding | ||
| 42 | --- ------- | ||
| 43 | |||
| 44 | C-g abort-recursive-edit | ||
| 45 | TAB minibuffer-complete | ||
| 46 | C-j minibuffer-complete-and-exit | ||
| 47 | RET minibuffer-complete-and-exit | ||
| 48 | ESC Prefix Command | ||
| 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 | ||
| 58 | |||
| 59 | M-v switch-to-completions | ||
| 60 | |||
| 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 | ||
| 65 | |||
| 66 | ")) | ||
| 67 | (should (string= | ||
| 68 | (substitute-command-keys | ||
| 69 | "\\<minibuffer-local-must-match-map>\\[abort-recursive-edit]") | ||
| 70 | "C-g")) | ||
| 71 | ;; Allow any style of quotes, since the terminal might not support | ||
| 72 | ;; UTF-8. | ||
| 73 | (should (string-match | ||
| 74 | "\nUses keymap [`‘']foobar-map['’], which is not currently defined.\n" | ||
| 75 | (substitute-command-keys "\\{foobar-map}"))) | ||
| 76 | ;; Quotes. | ||
| 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'"))) | ||
| 86 | ;; Bugs. | ||
| 87 | (should (string= (substitute-command-keys "\\[foobar") "\\[foobar")) | ||
| 88 | (should (string= (substitute-command-keys "\\=") "\\=")) | ||
| 89 | ) | ||
| 90 | |||
| 91 | (provide 'doc-tests) | ||
| 92 | ;;; doc-tests.el ends here | ||