aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMichael Albinus2015-08-24 14:26:57 +0200
committerMichael Albinus2015-08-24 14:26:57 +0200
commit7eab29d251b893d5b7f87f1801706a86043fa428 (patch)
tree377da59be89d2405db55f450b864472f6cb86f0e /test
parent1c6bdf18c0f2116edef7f7195ca5ed7a55a05e73 (diff)
downloademacs-7eab29d251b893d5b7f87f1801706a86043fa428.tar.gz
emacs-7eab29d251b893d5b7f87f1801706a86043fa428.zip
* lisp/net/tramp-sh.el (tramp-stat-marker, tramp-stat-quoted-marker):
New defconsts. (tramp-do-file-attributes-with-stat) (tramp-do-directory-files-and-attributes-with-stat): Use them. (tramp-convert-file-attributes): Remove double slashes in symlinks. * test/automated/tramp-tests.el (tramp-test18-file-attributes): Handle symlinks with "//" in the file name.
Diffstat (limited to 'test')
-rw-r--r--test/automated/tramp-tests.el33
1 files changed, 31 insertions, 2 deletions
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el
index e6f77e42499..498a0cfa7da 100644
--- a/test/automated/tramp-tests.el
+++ b/test/automated/tramp-tests.el
@@ -1058,6 +1058,13 @@ This tests also `file-readable-p' and `file-regular-p'."
1058 (file-truename tramp-test-temporary-file-directory)) 1058 (file-truename tramp-test-temporary-file-directory))
1059 (tmp-name1 (tramp--test-make-temp-name)) 1059 (tmp-name1 (tramp--test-make-temp-name))
1060 (tmp-name2 (tramp--test-make-temp-name)) 1060 (tmp-name2 (tramp--test-make-temp-name))
1061 ;; File name with "//".
1062 (tmp-name3
1063 (format
1064 "%s%s"
1065 (file-remote-p tmp-name1)
1066 (replace-regexp-in-string
1067 "/" "//" (file-remote-p tmp-name1 'localname))))
1061 attr) 1068 attr)
1062 (unwind-protect 1069 (unwind-protect
1063 (progn 1070 (progn
@@ -1099,8 +1106,24 @@ This tests also `file-readable-p' and `file-regular-p'."
1099 (file-error 1106 (file-error
1100 (should (string-equal (error-message-string err) 1107 (should (string-equal (error-message-string err)
1101 "make-symbolic-link not supported")))) 1108 "make-symbolic-link not supported"))))
1102 (delete-file tmp-name1)
1103 1109
1110 ;; Check, that "//" in symlinks are handled properly.
1111 (with-temp-buffer
1112 (let ((default-directory tramp-test-temporary-file-directory))
1113 (shell-command
1114 (format
1115 "ln -s %s %s"
1116 (tramp-file-name-localname (tramp-dissect-file-name tmp-name3))
1117 (tramp-file-name-localname (tramp-dissect-file-name tmp-name2)))
1118 t)))
1119 (when (file-symlink-p tmp-name2)
1120 (setq attr (file-attributes tmp-name2))
1121 (should (string-equal
1122 (car attr)
1123 (file-remote-p (file-truename tmp-name3) 'localname)))
1124 (delete-file tmp-name2))
1125
1126 (delete-file tmp-name1)
1104 (make-directory tmp-name1) 1127 (make-directory tmp-name1)
1105 (should (file-exists-p tmp-name1)) 1128 (should (file-exists-p tmp-name1))
1106 (should (file-readable-p tmp-name1)) 1129 (should (file-readable-p tmp-name1))
@@ -1109,7 +1132,9 @@ This tests also `file-readable-p' and `file-regular-p'."
1109 (should (eq (car attr) t))) 1132 (should (eq (car attr) t)))
1110 1133
1111 ;; Cleanup. 1134 ;; Cleanup.
1112 (ignore-errors (delete-directory tmp-name1))))) 1135 (ignore-errors (delete-directory tmp-name1))
1136 (ignore-errors (delete-file tmp-name1))
1137 (ignore-errors (delete-file tmp-name2)))))
1113 1138
1114(ert-deftest tramp-test19-directory-files-and-attributes () 1139(ert-deftest tramp-test19-directory-files-and-attributes ()
1115 "Check `directory-files-and-attributes'." 1140 "Check `directory-files-and-attributes'."
@@ -1198,6 +1223,8 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1198 (tmp-name1 (tramp--test-make-temp-name)) 1223 (tmp-name1 (tramp--test-make-temp-name))
1199 (tmp-name2 (tramp--test-make-temp-name)) 1224 (tmp-name2 (tramp--test-make-temp-name))
1200 (tmp-name3 (tramp--test-make-temp-name 'local))) 1225 (tmp-name3 (tramp--test-make-temp-name 'local)))
1226
1227 ;; Check `make-symbolic-link'.
1201 (unwind-protect 1228 (unwind-protect
1202 (progn 1229 (progn
1203 (write-region "foo" nil tmp-name1) 1230 (write-region "foo" nil tmp-name1)
@@ -1223,6 +1250,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1223 (delete-file tmp-name1) 1250 (delete-file tmp-name1)
1224 (delete-file tmp-name2))) 1251 (delete-file tmp-name2)))
1225 1252
1253 ;; Check `add-name-to-file'.
1226 (unwind-protect 1254 (unwind-protect
1227 (progn 1255 (progn
1228 (write-region "foo" nil tmp-name1) 1256 (write-region "foo" nil tmp-name1)
@@ -1240,6 +1268,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'."
1240 (delete-file tmp-name1) 1268 (delete-file tmp-name1)
1241 (delete-file tmp-name2))) 1269 (delete-file tmp-name2)))
1242 1270
1271 ;; Check `file-truename'.
1243 (unwind-protect 1272 (unwind-protect
1244 (progn 1273 (progn
1245 (write-region "foo" nil tmp-name1) 1274 (write-region "foo" nil tmp-name1)