diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/ChangeLog | 6 | ||||
| -rw-r--r-- | test/automated/vc-bzr.el | 101 |
2 files changed, 107 insertions, 0 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index ea6d90b534c..396273bab37 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2011-10-20 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * automated/vc-bzr.el (vc-bzr-test-bug9781): New test. | ||
| 4 | |||
| 5 | * automated/vc-bzr.el: New file. | ||
| 6 | |||
| 1 | 2011-10-15 Glenn Morris <rgm@gnu.org> | 7 | 2011-10-15 Glenn Morris <rgm@gnu.org> |
| 2 | 8 | ||
| 3 | * automated/f90.el: New file. | 9 | * automated/f90.el: New file. |
diff --git a/test/automated/vc-bzr.el b/test/automated/vc-bzr.el new file mode 100644 index 00000000000..b2cbda4d669 --- /dev/null +++ b/test/automated/vc-bzr.el | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | ;;; vc-bzr.el --- tests for vc/vc-bzr.el | ||
| 2 | |||
| 3 | ;; Copyright (C) 2011 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Glenn Morris <rgm@gnu.org> | ||
| 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 <http://www.gnu.org/licenses/>. | ||
| 21 | |||
| 22 | ;;; Commentary: | ||
| 23 | |||
| 24 | ;;; Code: | ||
| 25 | |||
| 26 | (require 'ert) | ||
| 27 | (require 'vc-bzr) | ||
| 28 | (require 'vc-dir) | ||
| 29 | |||
| 30 | ;; FIXME it would be better to skip all these tests if there is no | ||
| 31 | ;; bzr installed. We could just put everything inside an IF | ||
| 32 | ;; statement, but it would be nice if ERT had a "skipped" facility (?). | ||
| 33 | |||
| 34 | (ert-deftest vc-bzr-test-bug9726 () | ||
| 35 | "Test for http://debbugs.gnu.org/9726 ." | ||
| 36 | :expected-result (if (executable-find vc-bzr-program) :passed :failed) | ||
| 37 | (should (executable-find vc-bzr-program)) | ||
| 38 | (let* ((tempdir (make-temp-file "vc-bzr-test" t)) | ||
| 39 | (ignored-dir (expand-file-name "ignored-dir" tempdir)) | ||
| 40 | (default-directory (file-name-as-directory tempdir))) | ||
| 41 | (unwind-protect | ||
| 42 | (progn | ||
| 43 | (make-directory ignored-dir) | ||
| 44 | (with-temp-buffer | ||
| 45 | (insert (file-name-nondirectory ignored-dir)) | ||
| 46 | (write-region nil nil (expand-file-name ".bzrignore" tempdir) | ||
| 47 | nil 'silent)) | ||
| 48 | (call-process vc-bzr-program nil nil nil "init") | ||
| 49 | (call-process vc-bzr-program nil nil nil "add") | ||
| 50 | (call-process vc-bzr-program nil nil nil "commit" "-m" "Commit 1") | ||
| 51 | (with-temp-buffer | ||
| 52 | (insert "unregistered file") | ||
| 53 | (write-region nil nil (expand-file-name "testfile2" ignored-dir) | ||
| 54 | nil 'silent)) | ||
| 55 | (vc-dir ignored-dir) | ||
| 56 | (while (vc-dir-busy) | ||
| 57 | (sit-for 0.1)) | ||
| 58 | ;; FIXME better to explicitly test for error from process sentinel. | ||
| 59 | (with-current-buffer "*vc-dir*" | ||
| 60 | (goto-char (point-min)) | ||
| 61 | (should (search-forward "unregistered" nil t)))) | ||
| 62 | (delete-directory tempdir t)))) | ||
| 63 | |||
| 64 | ;; Not specific to bzr. | ||
| 65 | (ert-deftest vc-bzr-test-bug9781 () | ||
| 66 | "Test for http://debbugs.gnu.org/9781 ." | ||
| 67 | :expected-result (if (executable-find vc-bzr-program) :passed :failed) | ||
| 68 | (should (executable-find vc-bzr-program)) | ||
| 69 | (let* ((tempdir (make-temp-file "vc-bzr-test" t)) | ||
| 70 | (subdir (expand-file-name "subdir" tempdir)) | ||
| 71 | (file (expand-file-name "file" tempdir)) | ||
| 72 | (default-directory (file-name-as-directory tempdir))) | ||
| 73 | (unwind-protect | ||
| 74 | (progn | ||
| 75 | (call-process vc-bzr-program nil nil nil "init") | ||
| 76 | (make-directory subdir) | ||
| 77 | (with-temp-buffer | ||
| 78 | (insert "text") | ||
| 79 | (write-region nil nil file nil 'silent) | ||
| 80 | (write-region nil nil (expand-file-name "subfile" subdir) | ||
| 81 | nil 'silent)) | ||
| 82 | (call-process vc-bzr-program nil nil nil "add") | ||
| 83 | (call-process vc-bzr-program nil nil nil "commit" "-m" "Commit 1") | ||
| 84 | (call-process vc-bzr-program nil nil nil "remove" subdir) | ||
| 85 | (with-temp-buffer | ||
| 86 | (insert "different text") | ||
| 87 | (write-region nil nil file nil 'silent)) | ||
| 88 | (vc-dir tempdir) | ||
| 89 | (while (vc-dir-busy) | ||
| 90 | (sit-for 0.1)) | ||
| 91 | (vc-dir-mark-all-files t) | ||
| 92 | (let ((f (symbol-function 'y-or-n-p))) | ||
| 93 | (unwind-protect | ||
| 94 | (progn | ||
| 95 | (fset 'y-or-n-p (lambda (prompt) t)) | ||
| 96 | (vc-next-action nil)) | ||
| 97 | (fset 'y-or-n-p f))) | ||
| 98 | (should (get-buffer "*vc-log*"))) | ||
| 99 | (delete-directory tempdir t)))) | ||
| 100 | |||
| 101 | ;;; vc-bzr.el ends here | ||