emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107863: Add another vc-bzr test


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107863: Add another vc-bzr test
Date: Tue, 10 Apr 2012 20:24:26 -0700
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107863
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2012-04-10 20:24:26 -0700
message:
  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.
modified:
  lisp/ChangeLog
  lisp/vc/vc-bzr.el
  test/ChangeLog
  test/automated/vc-bzr.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-11 02:36:04 +0000
+++ b/lisp/ChangeLog    2012-04-11 03:24:26 +0000
@@ -1,3 +1,7 @@
+2012-04-11  Glenn Morris  <address@hidden>
+
+       * vc/vc-bzr.el (vc-bzr-status): Avoid condition-case-unless-debug.
+
 2012-04-11  Stefan Monnier  <address@hidden>
 
        * window.el (window--state-get-1): Obey window-point-insertion-type.

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2012-04-11 02:06:59 +0000
+++ b/lisp/vc/vc-bzr.el 2012-04-11 03:24:26 +0000
@@ -410,7 +410,11 @@
 ;; (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::

=== modified file 'test/ChangeLog'
--- a/test/ChangeLog    2012-02-13 18:45:36 +0000
+++ b/test/ChangeLog    2012-04-11 03:24:26 +0000
@@ -1,3 +1,7 @@
+2012-04-11  Glenn Morris  <address@hidden>
+
+       * automated/vc-bzr.el (vc-bzr-test-faulty-bzr-autoloads): New test.
+
 2012-02-13  Teodor Zlatanov  <address@hidden>
 
        * automated/url-future-tests.el (url-future-tests): Move from

=== modified file 'test/automated/vc-bzr.el'
--- a/test/automated/vc-bzr.el  2012-01-05 09:46:05 +0000
+++ b/test/automated/vc-bzr.el  2012-04-11 03:24:26 +0000
@@ -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 <address@hidden>
 
@@ -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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]