From 581d24e701655c70bf318f00d270fb6f3aad2cc7 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 11 Feb 2014 09:31:39 +0100 Subject: [PATCH] * automated/tramp-tests.el (top): Require `vc', `vc-bzr', `vc-git' and `vc-hg'. Declare `tramp-find-executable' and `tramp-get-remote-path'. (tramp-test29-vc-registered): New test. (tramp-test30-utf8): Rename from `tramp-test29-utf8'. --- test/ChangeLog | 8 ++++++ test/automated/tramp-tests.el | 58 +++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 64 insertions(+), 2 deletions(-) diff --git a/test/ChangeLog b/test/ChangeLog index e3902c02477..370545d4368 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,11 @@ +2014-02-11 Michael Albinus + + * automated/tramp-tests.el (top): Require `vc', `vc-bzr', `vc-git' + and `vc-hg'. Declare `tramp-find-executable' and + `tramp-get-remote-path'. + (tramp-test29-vc-registered): New test. + (tramp-test30-utf8): Rename from `tramp-test29-utf8'. + 2014-02-07 Michael Albinus * automated/tramp-tests.el (tramp-test26-process-file): Improve test. diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 67f55254da1..46540317e37 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el @@ -37,6 +37,13 @@ (require 'ert) (require 'tramp) +(require 'vc) +(require 'vc-bzr) +(require 'vc-git) +(require 'vc-hg) + +(declare-function tramp-find-executable "tramp-sh") +(declare-function tramp-get-remote-path "tramp-sh") ;; There is no default value on w32 systems, which could work out of the box. (defconst tramp-test-temporary-file-directory @@ -1188,7 +1195,55 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." (format "%s\n" (file-name-nondirectory tmp-name)) (buffer-string)))) (ignore-errors (delete-file tmp-name))))) -(ert-deftest tramp-test29-utf8 () +(ert-deftest tramp-test29-vc-registered () + "Check `vc-registered'." + (skip-unless (tramp--test-enabled)) + (skip-unless + (eq + (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory) + 'tramp-sh-file-name-handler)) + (tramp-cleanup-connection + (tramp-dissect-file-name tramp-test-temporary-file-directory) + nil 'keep-password) + + (let* ((default-directory tramp-test-temporary-file-directory) + (tmp-name1 (tramp--test-make-temp-name)) + (tmp-name2 (expand-file-name "foo" tmp-name1)) + (vc-handled-backends + (with-parsed-tramp-file-name tramp-test-temporary-file-directory nil + (cond + ((tramp-find-executable v vc-bzr-program (tramp-get-remote-path v)) + '(Bzr)) + ((tramp-find-executable v vc-git-program (tramp-get-remote-path v)) + '(Git)) + ((tramp-find-executable v vc-hg-program (tramp-get-remote-path v)) + '(Hg)) + (t nil))))) + (skip-unless vc-handled-backends) + (message "%s" vc-handled-backends) + + (unwind-protect + (progn + (make-directory tmp-name1) + (write-region "foo" nil tmp-name2) + (should (file-directory-p tmp-name1)) + (should (file-exists-p tmp-name2)) + (should-not (vc-registered tmp-name1)) + (should-not (vc-registered tmp-name2)) + + (let ((default-directory tmp-name1)) + ;; Create empty repository, and register the file. + (vc-create-repo (car vc-handled-backends)) + ;; The structure of VC-FILESET is not documented. Let's + ;; hope it won't change. + (vc-register + nil (list (car vc-handled-backends) + (list (file-name-nondirectory tmp-name2))))) + (should (vc-registered tmp-name2))) + + (ignore-errors (delete-directory tmp-name1 'recursive))))) + +(ert-deftest tramp-test30-utf8 () "Check UTF8 encoding in file names and file contents." (skip-unless (tramp--test-enabled)) (tramp-cleanup-connection @@ -1227,7 +1282,6 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; * make-auto-save-file-name ;; * set-file-acl ;; * set-file-selinux-context -;; * vc-registered ;; * Fix `tramp-test17-insert-directory' for ;; `ls-lisp-insert-directory' ("plink" and friends). -- 2.11.4.GIT