diff options
| -rw-r--r-- | lisp/net/tramp.el | 5 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 13 |
2 files changed, 13 insertions, 5 deletions
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 8a81311508f..00ecb375c59 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el | |||
| @@ -1146,6 +1146,11 @@ entry does not exist, return nil." | |||
| 1146 | "Return t if NAME is a string with Tramp file name syntax." | 1146 | "Return t if NAME is a string with Tramp file name syntax." |
| 1147 | (save-match-data | 1147 | (save-match-data |
| 1148 | (and (stringp name) | 1148 | (and (stringp name) |
| 1149 | ;; No "/:" and "/c:". This is not covered by `tramp-file-name-regexp'. | ||
| 1150 | (not (string-match | ||
| 1151 | (if (memq system-type '(cygwin windows-nt)) | ||
| 1152 | "^/[[:alpha:]]?:" "^/:") | ||
| 1153 | name)) | ||
| 1149 | (string-match tramp-file-name-regexp name)))) | 1154 | (string-match tramp-file-name-regexp name)))) |
| 1150 | 1155 | ||
| 1151 | (defun tramp-find-method (method user host) | 1156 | (defun tramp-find-method (method user host) |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 5d9d3a039b6..4c3b83cdcd1 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -185,6 +185,8 @@ handled properly. BODY shall not contain a timeout." | |||
| 185 | (should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) | 185 | (should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) |
| 186 | (should (tramp-tramp-file-p | 186 | (should (tramp-tramp-file-p |
| 187 | "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) | 187 | "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) |
| 188 | (should (tramp-tramp-file-p "/host1|host2:")) | ||
| 189 | (should (tramp-tramp-file-p "/user1@host1|user2@host2:")) | ||
| 188 | 190 | ||
| 189 | ;; No strings. | 191 | ;; No strings. |
| 190 | (should-not (tramp-tramp-file-p nil)) | 192 | (should-not (tramp-tramp-file-p nil)) |
| @@ -193,12 +195,13 @@ handled properly. BODY shall not contain a timeout." | |||
| 193 | (should-not (tramp-tramp-file-p "/::")) | 195 | (should-not (tramp-tramp-file-p "/::")) |
| 194 | (should-not (tramp-tramp-file-p "/:@:")) | 196 | (should-not (tramp-tramp-file-p "/:@:")) |
| 195 | (should-not (tramp-tramp-file-p "/:[]:")) | 197 | (should-not (tramp-tramp-file-p "/:[]:")) |
| 196 | ;; Multihops require a method. | ||
| 197 | (should-not (tramp-tramp-file-p "/host1|host2:")) | ||
| 198 | ;; Methods or hostnames shall be at least two characters on MS Windows. | 198 | ;; Methods or hostnames shall be at least two characters on MS Windows. |
| 199 | (when (memq system-type '(cygwin windows-nt)) | 199 | (let ((system-type 'windows-nt)) |
| 200 | (should-not (tramp-tramp-file-p "/c:/path/to/file")) | 200 | (should-not (tramp-tramp-file-p "/c:/path/to/file")) |
| 201 | (should-not (tramp-tramp-file-p "/c::/path/to/file")))) | 201 | (should-not (tramp-tramp-file-p "/c::/path/to/file"))) |
| 202 | (let ((system-type 'gnu/linux)) | ||
| 203 | (should (tramp-tramp-file-p "/h:/path/to/file")) | ||
| 204 | (should (tramp-tramp-file-p "/m::/path/to/file")))) | ||
| 202 | 205 | ||
| 203 | (ert-deftest tramp-test02-file-name-dissect () | 206 | (ert-deftest tramp-test02-file-name-dissect () |
| 204 | "Check remote file name components." | 207 | "Check remote file name components." |