(defvar vc-test--cleanup-hook nil
"Functions for cleanup at the end of an ert test.
-Don't set it globally, the functions shall be let-bound.")
+Don't set it globally, the functions should be let-bound.")
(defun vc-test--revision-granularity-function (backend)
"Run the `vc-revision-granularity' backend function."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--create-repo" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
(should (eq (vc-responsible-backend default-directory) backend)))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
;; FIXME: Why isn't there `vc-unregister'?
(defun vc-test--unregister-function (backend file)
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
-
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--register" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
;; Cleanup.
(should-not (vc-backend tmp-name2))
(should-not (vc-registered tmp-name2)))
- ;; The files shall still exist.
+ ;; The files should still exist.
(should (file-exists-p tmp-name1))
(should (file-exists-p tmp-name2))))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
(defun vc-test--state (backend)
"Check the different states of a file."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--working-revision" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
(should-not (vc-working-revision tmp-name)))))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
(defun vc-test--checkout-model (backend)
"Check the checkout model of a repository."
(file-name-as-directory
(expand-file-name
(make-temp-name "vc-test") temporary-file-directory)))
+ (process-environment process-environment)
+ tempdir
vc-test--cleanup-hook)
+ (when (eq backend 'Bzr)
+ (setq tempdir (make-temp-file "vc-test--checkout-model" t)
+ process-environment (cons (format "BZR_HOME=%s" tempdir)
+ process-environment)))
(unwind-protect
(progn
'(announce implicit locking))))))
;; Save exit.
- (ignore-errors (run-hooks 'vc-test--cleanup-hook)))))
+ (ignore-errors
+ (if tempdir (delete-directory tempdir t))
+ (run-hooks 'vc-test--cleanup-hook)))))
;; Create the test cases.