diff options
| author | Tino Calancha | 2017-10-27 20:21:26 +0900 |
|---|---|---|
| committer | Tino Calancha | 2017-10-27 20:21:26 +0900 |
| commit | 7f089aa5f6d208209b2cfef8e0d3d9530e191248 (patch) | |
| tree | 6ead3d30cda9725f34710e07381d4d3a179b3e1d | |
| parent | 53aaad1dfc1f9e0ffe7ee457967426584cd7f541 (diff) | |
| download | emacs-7f089aa5f6d208209b2cfef8e0d3d9530e191248.tar.gz emacs-7f089aa5f6d208209b2cfef8e0d3d9530e191248.zip | |
Require seq in rmc.el
* lisp/emacs-lisp/rmc.el: Require seq (Bug#28975).
* test/lisp/emacs-lisp/rmc-tests.el (test-read-multiple-choice): Add test.
| -rw-r--r-- | lisp/emacs-lisp/rmc.el | 2 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/rmc-tests.el | 41 |
2 files changed, 43 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/rmc.el b/lisp/emacs-lisp/rmc.el index 0be6971992c..ca11c596638 100644 --- a/lisp/emacs-lisp/rmc.el +++ b/lisp/emacs-lisp/rmc.el | |||
| @@ -23,6 +23,8 @@ | |||
| 23 | 23 | ||
| 24 | ;;; Code: | 24 | ;;; Code: |
| 25 | 25 | ||
| 26 | (require 'seq) | ||
| 27 | |||
| 26 | ;;;###autoload | 28 | ;;;###autoload |
| 27 | (defun read-multiple-choice (prompt choices) | 29 | (defun read-multiple-choice (prompt choices) |
| 28 | "Ask user a multiple choice question. | 30 | "Ask user a multiple choice question. |
diff --git a/test/lisp/emacs-lisp/rmc-tests.el b/test/lisp/emacs-lisp/rmc-tests.el new file mode 100644 index 00000000000..7ab79fda774 --- /dev/null +++ b/test/lisp/emacs-lisp/rmc-tests.el | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | ;;; rmc-tests.el --- Test suite for rmc.el -*- lexical-binding: t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2017 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Tino Calancha <tino.calancha@gmail.com> | ||
| 6 | ;; Keywords: | ||
| 7 | |||
| 8 | ;; This program is free software; you can redistribute it and/or modify | ||
| 9 | ;; it under the terms of the GNU General Public License as published by | ||
| 10 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 11 | ;; (at your option) any later version. | ||
| 12 | |||
| 13 | ;; This program is distributed in the hope that it will be useful, | ||
| 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | ;; GNU General Public License for more details. | ||
| 17 | |||
| 18 | ;; You should have received a copy of the GNU General Public License | ||
| 19 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 20 | |||
| 21 | ;;; Commentary: | ||
| 22 | |||
| 23 | ;; | ||
| 24 | |||
| 25 | ;;; Code: | ||
| 26 | |||
| 27 | (require 'ert) | ||
| 28 | (require 'rmc) | ||
| 29 | (eval-when-compile (require 'cl-lib)) | ||
| 30 | |||
| 31 | |||
| 32 | (ert-deftest test-read-multiple-choice () | ||
| 33 | (dolist (char '(?y ?n)) | ||
| 34 | (cl-letf* (((symbol-function #'read-char) (lambda () char)) | ||
| 35 | (str (if (eq char ?y) "yes" "no"))) | ||
| 36 | (should (equal (list char str) | ||
| 37 | (read-multiple-choice "Do it? " '((?y "yes") (?n "no")))))))) | ||
| 38 | |||
| 39 | |||
| 40 | (provide 'rmc-tests) | ||
| 41 | ;;; rmc-tests.el ends here | ||