diff options
| author | Masatake YAMATO | 2013-04-10 02:37:17 +0900 |
|---|---|---|
| committer | Masatake YAMATO | 2013-04-10 02:37:17 +0900 |
| commit | 694569fc79b2923e054cd3064a16bb7decdc447d (patch) | |
| tree | 3204cea52f8d5ab314c0b113b99ef0e6c5c3d794 /test | |
| parent | 7144c62778d5c4700de4c9a12f9165423b12864e (diff) | |
| download | emacs-694569fc79b2923e054cd3064a16bb7decdc447d.tar.gz emacs-694569fc79b2923e054cd3064a16bb7decdc447d.zip | |
* test/automated/add-log-tests.el: New file.
Fixes: debbugs:14112
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 4 | ||||
| -rw-r--r-- | test/automated/add-log-tests.el | 84 |
2 files changed, 88 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index cd4414cd079..bf68984e9e8 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,7 @@ | |||
| 1 | 2013-04-09 Masatake YAMATO <yamato@redhat.com> | ||
| 2 | |||
| 3 | * automated/add-log-tests.el: New file. (Bug#14112) | ||
| 4 | |||
| 1 | 2013-03-30 Fabián Ezequiel Gallina <fabian@anue.biz> | 5 | 2013-03-30 Fabián Ezequiel Gallina <fabian@anue.biz> |
| 2 | 6 | ||
| 3 | * automated/python-tests.el (python-indent-block-enders): New test. | 7 | * automated/python-tests.el (python-indent-block-enders): New test. |
diff --git a/test/automated/add-log-tests.el b/test/automated/add-log-tests.el new file mode 100644 index 00000000000..28029e18b99 --- /dev/null +++ b/test/automated/add-log-tests.el | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | ;;; add-log-tests.el --- Test suite for add-log. | ||
| 2 | |||
| 3 | ;; Copyright (C) 2013 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Masatake YAMATO <yamato@redhat.com> | ||
| 6 | ;; Keywords: vc tools | ||
| 7 | |||
| 8 | ;; This file is part of GNU Emacs. | ||
| 9 | |||
| 10 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 11 | ;; it under the terms of the GNU General Public License as published by | ||
| 12 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 13 | ;; (at your option) any later version. | ||
| 14 | |||
| 15 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 16 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 18 | ;; GNU General Public License for more details. | ||
| 19 | |||
| 20 | ;; You should have received a copy of the GNU General Public License | ||
| 21 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. | ||
| 22 | |||
| 23 | ;;; Code: | ||
| 24 | |||
| 25 | (require 'add-log) | ||
| 26 | |||
| 27 | (defmacro add-log-current-defun-deftest (name doc major-mode | ||
| 28 | content marker expected-defun) | ||
| 29 | "Generate an ert test for mode-own `add-log-current-defun-function'. | ||
| 30 | Run `add-log-current-defun' at the point where MARKER specifies in a | ||
| 31 | buffer which content is CONTENT under MAJOR-MODE. Then it compares the | ||
| 32 | result with EXPECTED-DEFUN." | ||
| 33 | (let ((xname (intern (concat "add-log-current-defun-test-" | ||
| 34 | (symbol-name name) | ||
| 35 | )))) | ||
| 36 | `(ert-deftest ,xname () | ||
| 37 | ,doc | ||
| 38 | (with-temp-buffer | ||
| 39 | (insert ,content) | ||
| 40 | (goto-char (point-min)) | ||
| 41 | (funcall ',major-mode) | ||
| 42 | (should (equal (when (search-forward ,marker nil t) | ||
| 43 | (replace-match "" nil t) | ||
| 44 | (add-log-current-defun)) | ||
| 45 | ,expected-defun)))))) | ||
| 46 | |||
| 47 | (add-log-current-defun-deftest | ||
| 48 | sh-func1 | ||
| 49 | "Test sh-current-defun-name can find function." | ||
| 50 | sh-mode " | ||
| 51 | function foo | ||
| 52 | { | ||
| 53 | >< | ||
| 54 | }" "><" "foo") | ||
| 55 | |||
| 56 | (add-log-current-defun-deftest | ||
| 57 | sh-func2 | ||
| 58 | "Test sh-current-defun-name can find function." | ||
| 59 | sh-mode " | ||
| 60 | foo() | ||
| 61 | { | ||
| 62 | >< | ||
| 63 | }" "><" "foo") | ||
| 64 | |||
| 65 | (add-log-current-defun-deftest | ||
| 66 | sh-func3 | ||
| 67 | "Test sh-current-defun-name can find function." | ||
| 68 | sh-mode " | ||
| 69 | function foo() | ||
| 70 | { | ||
| 71 | >< | ||
| 72 | }" "><" "foo") | ||
| 73 | |||
| 74 | (add-log-current-defun-deftest | ||
| 75 | sh-var | ||
| 76 | "Test sh-current-defun-name can find variabe definition." | ||
| 77 | sh-mode " | ||
| 78 | PATH=a:/ab:/usr/abc | ||
| 79 | DIR=/pr><oc" | ||
| 80 | "><" "DIR") | ||
| 81 | |||
| 82 | (provide 'add-log-tests) | ||
| 83 | |||
| 84 | ;;; add-log-tests.el ends here | ||