emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 712a5fa: Extend tramp-tests.el


From: Michael Albinus
Subject: [Emacs-diffs] master 712a5fa: Extend tramp-tests.el
Date: Tue, 16 May 2017 08:50:04 -0400 (EDT)

branch: master
commit 712a5faa2c95596db2d4d94dada575ad16b317c5
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Extend tramp-tests.el
    
    * test/lisp/net/tramp-tests.el (tramp-change-syntax):
    Remove declaration, not needed anymore.
    (tramp-test05-expand-file-name-relative): New test.
    (tramp-test10-write-region): Extend test.
---
 test/lisp/net/tramp-tests.el | 31 +++++++++++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index d3a93d2..bcf2e84 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -45,7 +45,6 @@
 (require 'vc-git)
 (require 'vc-hg)
 
-(declare-function tramp-change-syntax "tramp-cmds")
 (declare-function tramp-find-executable "tramp-sh")
 (declare-function tramp-get-remote-path "tramp-sh")
 (declare-function tramp-get-remote-stat "tramp-sh")
@@ -1616,6 +1615,21 @@ handled properly.  BODY shall not contain a timeout."
     (expand-file-name "/method:host:/:/~/path/./file")
     "/method:host:/:/~/path/file")))
 
+;; The following test is inspired by Bug#26911.  It is rather a bug in
+;; `expand-file-name', and it fails for all Emacs versions.  Test
+;; added for later, when it is fixed.
+(ert-deftest tramp-test05-expand-file-name-relative ()
+  "Check `expand-file-name'."
+  ;; Mark as failed until bug has been fixed.
+  :expected-result :failed
+  (should
+   (string-equal
+    (let ((default-directory
+           (concat
+            (file-remote-p tramp-test-temporary-file-directory) "/path")))
+      (expand-file-name ".." "./"))
+    (concat (file-remote-p tramp-test-temporary-file-directory) "/"))))
+
 (ert-deftest tramp-test06-directory-file-name ()
   "Check `directory-file-name'.
 This checks also `file-name-as-directory', `file-name-directory',
@@ -1745,13 +1759,25 @@ This checks also `file-name-as-directory', 
`file-name-directory',
     (let ((tmp-name (tramp--test-make-temp-name nil quoted)))
       (unwind-protect
          (progn
-            ;; Write buffer.
+            ;; Write buffer.  Use absolute and relative file name.
            (with-temp-buffer
              (insert "foo")
              (write-region nil nil tmp-name))
            (with-temp-buffer
              (insert-file-contents tmp-name)
              (should (string-equal (buffer-string) "foo")))
+           (delete-file tmp-name)
+           (with-temp-buffer
+             (insert "foo")
+             (should-not (file-exists-p tmp-name))
+             (let ((default-directory (file-name-directory tmp-name)))
+               (should-not (file-exists-p (file-name-nondirectory tmp-name)))
+               (write-region nil nil (file-name-nondirectory tmp-name))
+               (should (file-exists-p (file-name-nondirectory tmp-name))))
+             (should (file-exists-p tmp-name)))
+           (with-temp-buffer
+             (insert-file-contents tmp-name)
+             (should (string-equal (buffer-string) "foo")))
 
            ;; Append.
            (with-temp-buffer
@@ -3721,6 +3747,7 @@ Since it unloads Tramp, it shall be the last test to run."
 ;; * set-file-selinux-context
 
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
+;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'.
 ;; * Fix `tramp-test06-directory-file-name' for `ftp'.
 ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
 ;; * Fix Bug#16928.  Set expected error of 
`tramp-test36-asynchronous-requests'.



reply via email to

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