diff options
| author | Philipp Stephani | 2020-05-14 19:26:43 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2020-05-14 19:29:14 +0200 |
| commit | 406fb0746c8b54869302d50b2327333769b7604b (patch) | |
| tree | fb6a44b50edd627e9a031ab3f474e39c6e0b9af5 /test | |
| parent | 747e0a2523e474c76410430c40cb9b04500218d4 (diff) | |
| download | emacs-406fb0746c8b54869302d50b2327333769b7604b.tar.gz emacs-406fb0746c8b54869302d50b2327333769b7604b.zip | |
Fix documentation related to 'command-switch-alist'.
While there, add a unit test to verify the behavior.
* doc/lispref/os.texi (Command-Line Arguments): Fix documentation: the
option string in 'command-switch-alist' does include leading hyphens.
Also mention that 'command-switch-alist' parsing ignores equals signs
in options.
* test/lisp/startup-tests.el
(startup-tests/command-switch-alist): New unit test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/startup-tests.el | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/test/lisp/startup-tests.el b/test/lisp/startup-tests.el new file mode 100644 index 00000000000..314ffc93e4a --- /dev/null +++ b/test/lisp/startup-tests.el | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | ;;; startup-tests.el --- unit tests for startup.el -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2020 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Philipp Stephani <phst@google.com> | ||
| 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 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;; Unit tests for startup.el. | ||
| 25 | |||
| 26 | ;;; Code: | ||
| 27 | |||
| 28 | (ert-deftest startup-tests/command-switch-alist () | ||
| 29 | (let* ((foo-args ()) (bar-args ()) | ||
| 30 | (command-switch-alist | ||
| 31 | (list (cons "--foo" | ||
| 32 | (lambda (arg) | ||
| 33 | (ert-info ("Processing argument --foo") | ||
| 34 | (push arg foo-args) | ||
| 35 | (should (equal command-line-args-left | ||
| 36 | '("value" "--bar=value"))) | ||
| 37 | (pop command-line-args-left)))) | ||
| 38 | (cons "--bar=value" | ||
| 39 | (lambda (arg) | ||
| 40 | (ert-info ("Processing argument --bar") | ||
| 41 | (push arg bar-args) | ||
| 42 | (should-not command-line-args-left))))))) | ||
| 43 | (command-line-1 '("--foo" "value" "--bar=value")) | ||
| 44 | (should (equal foo-args '("--foo"))) | ||
| 45 | (should (equal bar-args '("--bar=value"))))) | ||
| 46 | |||
| 47 | ;;; startup-tests.el ends here | ||