Add another vc-bzr test

* lisp/vc/vc-bzr.el (vc-bzr-status): Avoid condition-case-unless-debug.

* test/automated/vc-bzr.el (vc-bzr-test-faulty-bzr-autoloads): New test.
This commit is contained in:
Glenn Morris 2012-04-10 20:24:26 -07:00
parent de8c03dc51
commit ab7ce8c155
4 changed files with 41 additions and 2 deletions

View file

@ -1,3 +1,7 @@
2012-04-11 Glenn Morris <rgm@gnu.org>
* vc/vc-bzr.el (vc-bzr-status): Avoid condition-case-unless-debug.
2012-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
* window.el (window--state-get-1): Obey window-point-insertion-type.

View file

@ -410,7 +410,11 @@ in the branch repository (or whose status not be determined)."
;; (unchanged . WARNING). FIXME unchanged is not the best status to
;; return in case of error.
(with-temp-buffer
(with-demoted-errors (vc-bzr-command "status" t 0 file))
;; This is with-demoted-errors without the condition-case-unless-debug
;; annoyance, which makes it fail during ert testing.
(let (err)
(condition-case err (vc-bzr-command "status" t 0 file)
(error (message "Error: %S" err) nil)))
(let ((status 'unchanged))
;; the only secure status indication in `bzr status' output
;; is a couple of lines following the pattern::

View file

@ -1,3 +1,7 @@
2012-04-11 Glenn Morris <rgm@gnu.org>
* automated/vc-bzr.el (vc-bzr-test-faulty-bzr-autoloads): New test.
2012-02-13 Teodor Zlatanov <tzz@lifelogs.com>
* automated/url-future-tests.el (url-future-tests): Move from

View file

@ -1,6 +1,6 @@
;;; vc-bzr.el --- tests for vc/vc-bzr.el
;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
;; Copyright (C) 2011-2012 Free Software Foundation, Inc.
;; Author: Glenn Morris <rgm@gnu.org>
@ -98,4 +98,31 @@
(should (get-buffer "*vc-log*")))
(delete-directory tempdir t))))
;; http://lists.gnu.org/archive/html/help-gnu-emacs/2012-04/msg00145.html
(ert-deftest vc-bzr-test-faulty-bzr-autoloads ()
"Test we can generate autoloads in a bzr directory when bzr is faulty."
:expected-result (if (executable-find vc-bzr-program) :passed :failed)
(should (executable-find vc-bzr-program))
(let* ((tempdir (make-temp-file "vc-bzr-test" t))
(file (expand-file-name "foo.el" tempdir))
(default-directory (file-name-as-directory tempdir))
(generated-autoload-file (expand-file-name "loaddefs.el" tempdir)))
(unwind-protect
(progn
(call-process vc-bzr-program nil nil nil "init")
(with-temp-buffer
(insert ";;;###autoload
\(defun foo () \"foo\" (interactive) (message \"foo!\"))")
(write-region nil nil file nil 'silent))
(call-process vc-bzr-program nil nil nil "add")
(call-process vc-bzr-program nil nil nil "commit" "-m" "Commit 1")
;; Deleting dirstate ensures both that vc-bzr's status heuristic
;; fails, so it has to call the external bzr status, and
;; causes bzr status to fail. This simulates a broken bzr
;; installation.
(delete-file ".bzr/checkout/dirstate")
(should (progn (update-directory-autoloads default-directory)
t)))
(delete-directory tempdir t))))
;;; vc-bzr.el ends here