branch: externals/vc-jj
commit 8f27e323ede76ea6e4b4b61b40cbf2f1c7640fd7
Author: Rudi Schlatte <[email protected]>
Commit: Rudi Schlatte <[email protected]>
Kill leftover buffers upon failing test
---
vc-jj-tests.el | 40 +++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/vc-jj-tests.el b/vc-jj-tests.el
index ab2c2d6358..e4f1145f84 100644
--- a/vc-jj-tests.el
+++ b/vc-jj-tests.el
@@ -125,25 +125,27 @@ is needed."
;; Create two changes, make sure that the change ids in the
;; annotation buffer match. This test is supposed to detect
;; changes in the output format of `jj annotate'.
- (write-region "Line 1\n" nil "README")
- (setq change-1 (vc-jj-working-revision "README"))
- (shell-command "jj commit -m 'First change'")
- (write-region "Line 2\n" nil "README" t)
- (shell-command "jj describe -m 'Second change'")
- (setq change-2 (vc-jj-working-revision "README"))
- (find-file "README")
- (setq readme-buffer (current-buffer))
- (vc-annotate "README" change-2)
- (let ((annotation-process (get-buffer-process (current-buffer))))
- (while (process-live-p annotation-process)
- (accept-process-output annotation-process)))
- (setq annotation-buffer (current-buffer))
- (goto-char (point-min))
- (should (string-prefix-p (thing-at-point 'word) change-1))
- (forward-line)
- (should (string-prefix-p (thing-at-point 'word) change-2))
- (kill-buffer readme-buffer)
- (kill-buffer annotation-buffer))))
+ (unwind-protect
+ (progn
+ (write-region "Line 1\n" nil "README")
+ (setq change-1 (vc-jj-working-revision "README"))
+ (shell-command "jj commit -m 'First change'")
+ (write-region "Line 2\n" nil "README" t)
+ (shell-command "jj describe -m 'Second change'")
+ (setq change-2 (vc-jj-working-revision "README"))
+ (find-file "README")
+ (setq readme-buffer (current-buffer))
+ (vc-annotate "README" change-2)
+ (let ((annotation-process (get-buffer-process (current-buffer))))
+ (while (process-live-p annotation-process)
+ (accept-process-output annotation-process)))
+ (setq annotation-buffer (current-buffer))
+ (goto-char (point-min))
+ (should (string-prefix-p (thing-at-point 'word) change-1))
+ (forward-line)
+ (should (string-prefix-p (thing-at-point 'word) change-2)))
+ (when (buffer-live-p readme-buffer) (kill-buffer readme-buffer))
+ (when (buffer-live-p annotation-buffer) (kill-buffer
annotation-buffer))))))
(ert-deftest vc-jj-ignore ()
(vc-jj-test-with-repo repo