diff options
| author | Michael Albinus | 2019-12-22 13:48:36 +0100 |
|---|---|---|
| committer | Michael Albinus | 2019-12-22 13:48:36 +0100 |
| commit | 753389448de3b0da608f0631349aa84c2281ee1f (patch) | |
| tree | b83cff363e81be704c1ffc71a39399e421542fa9 /test | |
| parent | 481eff8dfda6e4cdfa7c3311ccc59e7794252ab7 (diff) | |
| download | emacs-753389448de3b0da608f0631349aa84c2281ee1f.tar.gz emacs-753389448de3b0da608f0631349aa84c2281ee1f.zip | |
Extend tramp-tests.el for other host name syntax and file name syntax
* test/lisp/net/tramp-tests.el (inhibit-message)
(connection-local-criteria-alist)
(connection-local-profile-alist, async-shell-command-width): Declare.
(tramp-test01-file-name-syntax)
(tramp-test02-file-name-dissect): Set syntax to `default'.
(tramp-test03-file-name-defaults)
(tramp-test03-file-name-host-rules)
(tramp-test03-file-name-method-rules)
(tramp-test04-substitute-in-file-name)
(tramp-test05-expand-file-name)
(tramp-test06-directory-file-name, tramp-test44-auto-load):
Skip unless syntax is `default'.
(tramp-test06-directory-file-name, tramp-test10-write-region)
(tramp-test17-dired-with-wildcards)
(tramp-test26-file-name-completion): Handle IPv6 host names.
(tramp-test21-file-links): Support all syntaxes.
(tramp-test30-make-process, tramp-test45-unload):
Suppress compiler warnings.
(tramp-test37-make-auto-save-file-name): Skip for `separate' syntax.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 1209 |
1 files changed, 656 insertions, 553 deletions
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index e92bc8fd3ca..77b3ea0ad21 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -67,6 +67,14 @@ | |||
| 67 | (defvar tramp-remote-path) | 67 | (defvar tramp-remote-path) |
| 68 | (defvar tramp-remote-process-environment) | 68 | (defvar tramp-remote-process-environment) |
| 69 | 69 | ||
| 70 | ;; Needed for Emacs 24. | ||
| 71 | (defvar inhibit-message) | ||
| 72 | ;; Needed for Emacs 25. | ||
| 73 | (defvar connection-local-criteria-alist) | ||
| 74 | (defvar connection-local-profile-alist) | ||
| 75 | ;; Needed for Emacs 26. | ||
| 76 | (defvar async-shell-command-width) | ||
| 77 | |||
| 70 | ;; Beautify batch mode. | 78 | ;; Beautify batch mode. |
| 71 | (when noninteractive | 79 | (when noninteractive |
| 72 | ;; Suppress nasty messages. | 80 | ;; Suppress nasty messages. |
| @@ -221,79 +229,89 @@ properly. BODY shall not contain a timeout." | |||
| 221 | 229 | ||
| 222 | (ert-deftest tramp-test01-file-name-syntax () | 230 | (ert-deftest tramp-test01-file-name-syntax () |
| 223 | "Check remote file name syntax." | 231 | "Check remote file name syntax." |
| 224 | ;; Simple cases. | 232 | (let ((syntax tramp-syntax)) |
| 225 | (should (tramp-tramp-file-p "/method::")) | 233 | (unwind-protect |
| 226 | (should (tramp-tramp-file-p "/method:host:")) | 234 | (progn |
| 227 | (should (tramp-tramp-file-p "/method:user@:")) | 235 | (tramp-change-syntax 'default) |
| 228 | (should (tramp-tramp-file-p "/method:user@host:")) | 236 | ;; Simple cases. |
| 229 | (should (tramp-tramp-file-p "/method:user@email@host:")) | 237 | (should (tramp-tramp-file-p "/method::")) |
| 230 | 238 | (should (tramp-tramp-file-p "/method:host:")) | |
| 231 | ;; Using a port. | 239 | (should (tramp-tramp-file-p "/method:user@:")) |
| 232 | (should (tramp-tramp-file-p "/method:host#1234:")) | 240 | (should (tramp-tramp-file-p "/method:user@host:")) |
| 233 | (should (tramp-tramp-file-p "/method:user@host#1234:")) | 241 | (should (tramp-tramp-file-p "/method:user@email@host:")) |
| 234 | 242 | ||
| 235 | ;; Using an IPv4 address. | 243 | ;; Using a port. |
| 236 | (should (tramp-tramp-file-p "/method:1.2.3.4:")) | 244 | (should (tramp-tramp-file-p "/method:host#1234:")) |
| 237 | (should (tramp-tramp-file-p "/method:user@1.2.3.4:")) | 245 | (should (tramp-tramp-file-p "/method:user@host#1234:")) |
| 238 | 246 | ||
| 239 | ;; Using an IPv6 address. | 247 | ;; Using an IPv4 address. |
| 240 | (should (tramp-tramp-file-p "/method:[::1]:")) | 248 | (should (tramp-tramp-file-p "/method:1.2.3.4:")) |
| 241 | (should (tramp-tramp-file-p "/method:user@[::1]:")) | 249 | (should (tramp-tramp-file-p "/method:user@1.2.3.4:")) |
| 242 | 250 | ||
| 243 | ;; Using an IPv4 mapped IPv6 address. | 251 | ;; Using an IPv6 address. |
| 244 | (should (tramp-tramp-file-p "/method:[::ffff:1.2.3.4]:")) | 252 | (should (tramp-tramp-file-p "/method:[::1]:")) |
| 245 | (should (tramp-tramp-file-p "/method:user@[::ffff:1.2.3.4]:")) | 253 | (should (tramp-tramp-file-p "/method:user@[::1]:")) |
| 246 | 254 | ||
| 247 | ;; Local file name part. | 255 | ;; Using an IPv4 mapped IPv6 address. |
| 248 | (should (tramp-tramp-file-p "/method:::")) | 256 | (should (tramp-tramp-file-p "/method:[::ffff:1.2.3.4]:")) |
| 249 | (should (tramp-tramp-file-p "/method::/:")) | 257 | (should (tramp-tramp-file-p "/method:user@[::ffff:1.2.3.4]:")) |
| 250 | (should (tramp-tramp-file-p "/method::/path/to/file")) | 258 | |
| 251 | (should (tramp-tramp-file-p "/method::/:/path/to/file")) | 259 | ;; Local file name part. |
| 252 | (should (tramp-tramp-file-p "/method::file")) | 260 | (should (tramp-tramp-file-p "/method:::")) |
| 253 | (should (tramp-tramp-file-p "/method::/:file")) | 261 | (should (tramp-tramp-file-p "/method::/:")) |
| 254 | 262 | (should (tramp-tramp-file-p "/method::/path/to/file")) | |
| 255 | ;; Multihop. | 263 | (should (tramp-tramp-file-p "/method::/:/path/to/file")) |
| 256 | (should (tramp-tramp-file-p "/method1:|method2::")) | 264 | (should (tramp-tramp-file-p "/method::file")) |
| 257 | (should (tramp-tramp-file-p "/method1:host1|method2:host2:")) | 265 | (should (tramp-tramp-file-p "/method::/:file")) |
| 258 | (should (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) | 266 | |
| 259 | (should (tramp-tramp-file-p | 267 | ;; Multihop. |
| 260 | "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) | 268 | (should (tramp-tramp-file-p "/method1:|method2::")) |
| 261 | 269 | (should | |
| 262 | ;; No strings. | 270 | (tramp-tramp-file-p "/method1:host1|method2:host2:")) |
| 263 | (should-not (tramp-tramp-file-p nil)) | 271 | (should |
| 264 | (should-not (tramp-tramp-file-p 'symbol)) | 272 | (tramp-tramp-file-p "/method1:user1@host1|method2:user2@host2:")) |
| 265 | ;; No newline or linefeed. | 273 | (should |
| 266 | (should-not (tramp-tramp-file-p "/method::file\nname")) | 274 | (tramp-tramp-file-p |
| 267 | (should-not (tramp-tramp-file-p "/method::file\rname")) | 275 | "/method1:user1@host1|method2:user2@host2|method3:user3@host3:")) |
| 268 | ;; Ange-FTP syntax. | 276 | |
| 269 | (should-not (tramp-tramp-file-p "/host:")) | 277 | ;; No strings. |
| 270 | (should-not (tramp-tramp-file-p "/user@host:")) | 278 | (should-not (tramp-tramp-file-p nil)) |
| 271 | (should-not (tramp-tramp-file-p "/1.2.3.4:")) | 279 | (should-not (tramp-tramp-file-p 'symbol)) |
| 272 | (should-not (tramp-tramp-file-p "/[]:")) | 280 | ;; No newline or linefeed. |
| 273 | (should-not (tramp-tramp-file-p "/[::1]:")) | 281 | (should-not (tramp-tramp-file-p "/method::file\nname")) |
| 274 | (should-not (tramp-tramp-file-p "/[::ffff:1.2.3.4]:")) | 282 | (should-not (tramp-tramp-file-p "/method::file\rname")) |
| 275 | (should-not (tramp-tramp-file-p "/host:/:")) | 283 | ;; Ange-FTP syntax. |
| 276 | (should-not (tramp-tramp-file-p "/host1|host2:")) | 284 | (should-not (tramp-tramp-file-p "/host:")) |
| 277 | (should-not (tramp-tramp-file-p "/user1@host1|user2@host2:")) | 285 | (should-not (tramp-tramp-file-p "/user@host:")) |
| 278 | ;; Quote with "/:" suppresses file name handlers. | 286 | (should-not (tramp-tramp-file-p "/1.2.3.4:")) |
| 279 | (should-not (tramp-tramp-file-p "/::")) | 287 | (should-not (tramp-tramp-file-p "/[]:")) |
| 280 | (should-not (tramp-tramp-file-p "/:@:")) | 288 | (should-not (tramp-tramp-file-p "/[::1]:")) |
| 281 | (should-not (tramp-tramp-file-p "/:[]:")) | 289 | (should-not (tramp-tramp-file-p "/[::ffff:1.2.3.4]:")) |
| 282 | ;; When `tramp-mode' is nil, Tramp is not activated. | 290 | (should-not (tramp-tramp-file-p "/host:/:")) |
| 283 | (let (tramp-mode) | 291 | (should-not (tramp-tramp-file-p "/host1|host2:")) |
| 284 | (should-not (tramp-tramp-file-p "/method:user@host:"))) | 292 | (should-not (tramp-tramp-file-p "/user1@host1|user2@host2:")) |
| 285 | ;; `tramp-ignored-file-name-regexp' suppresses Tramp. | 293 | ;; Quote with "/:" suppresses file name handlers. |
| 286 | (let ((tramp-ignored-file-name-regexp "^/method:user@host:")) | 294 | (should-not (tramp-tramp-file-p "/::")) |
| 287 | (should-not (tramp-tramp-file-p "/method:user@host:"))) | 295 | (should-not (tramp-tramp-file-p "/:@:")) |
| 288 | ;; Methods shall be at least two characters on MS Windows, except | 296 | (should-not (tramp-tramp-file-p "/:[]:")) |
| 289 | ;; the default method. | 297 | ;; When `tramp-mode' is nil, Tramp is not activated. |
| 290 | (let ((system-type 'windows-nt)) | 298 | (let (tramp-mode) |
| 291 | (should-not (tramp-tramp-file-p "/c:/path/to/file")) | 299 | (should-not (tramp-tramp-file-p "/method:user@host:"))) |
| 292 | (should-not (tramp-tramp-file-p "/c::/path/to/file")) | 300 | ;; `tramp-ignored-file-name-regexp' suppresses Tramp. |
| 293 | (should (tramp-tramp-file-p "/-::/path/to/file"))) | 301 | (let ((tramp-ignored-file-name-regexp "^/method:user@host:")) |
| 294 | (let ((system-type 'gnu/linux)) | 302 | (should-not (tramp-tramp-file-p "/method:user@host:"))) |
| 295 | (should (tramp-tramp-file-p "/-:h:/path/to/file")) | 303 | ;; Methods shall be at least two characters on MS Windows, |
| 296 | (should (tramp-tramp-file-p "/m::/path/to/file")))) | 304 | ;; except the default method. |
| 305 | (let ((system-type 'windows-nt)) | ||
| 306 | (should-not (tramp-tramp-file-p "/c:/path/to/file")) | ||
| 307 | (should-not (tramp-tramp-file-p "/c::/path/to/file")) | ||
| 308 | (should (tramp-tramp-file-p "/-::/path/to/file"))) | ||
| 309 | (let ((system-type 'gnu/linux)) | ||
| 310 | (should (tramp-tramp-file-p "/-:h:/path/to/file")) | ||
| 311 | (should (tramp-tramp-file-p "/m::/path/to/file")))) | ||
| 312 | |||
| 313 | ;; Exit. | ||
| 314 | (tramp-change-syntax syntax)))) | ||
| 297 | 315 | ||
| 298 | (ert-deftest tramp-test01-file-name-syntax-simplified () | 316 | (ert-deftest tramp-test01-file-name-syntax-simplified () |
| 299 | "Check simplified file name syntax." | 317 | "Check simplified file name syntax." |
| @@ -424,442 +442,499 @@ properly. BODY shall not contain a timeout." | |||
| 424 | (non-essential t) | 442 | (non-essential t) |
| 425 | ;; Suppress check for multihops. | 443 | ;; Suppress check for multihops. |
| 426 | (tramp-cache-data (make-hash-table :test #'equal)) | 444 | (tramp-cache-data (make-hash-table :test #'equal)) |
| 427 | (tramp-connection-properties '((nil "login-program" t)))) | 445 | (tramp-connection-properties '((nil "login-program" t))) |
| 428 | ;; An unknown method shall raise an error. | 446 | (syntax tramp-syntax)) |
| 429 | (let (non-essential) | 447 | (unwind-protect |
| 430 | (should-error | 448 | (progn |
| 431 | (expand-file-name "/method:user@host:") | 449 | (tramp-change-syntax 'default) |
| 432 | :type 'user-error)) | 450 | ;; An unknown method shall raise an error. |
| 433 | 451 | (let (non-essential) | |
| 434 | ;; Expand `tramp-default-user' and `tramp-default-host'. | 452 | (should-error |
| 435 | (should (string-equal | 453 | (expand-file-name "/method:user@host:") |
| 436 | (file-remote-p "/method::") | 454 | :type 'user-error)) |
| 437 | (format "/%s:%s@%s:" "method" "default-user" "default-host"))) | ||
| 438 | (should (string-equal (file-remote-p "/method::" 'method) "method")) | ||
| 439 | (should (string-equal (file-remote-p "/method::" 'user) "default-user")) | ||
| 440 | (should (string-equal (file-remote-p "/method::" 'host) "default-host")) | ||
| 441 | (should (string-equal (file-remote-p "/method::" 'localname) "")) | ||
| 442 | (should (string-equal (file-remote-p "/method::" 'hop) nil)) | ||
| 443 | |||
| 444 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 445 | (should (string-equal | ||
| 446 | (file-remote-p "/-:host:") | ||
| 447 | (format "/%s:%s@%s:" "default-method" "default-user" "host"))) | ||
| 448 | (should (string-equal (file-remote-p "/-:host:" 'method) "default-method")) | ||
| 449 | (should (string-equal (file-remote-p "/-:host:" 'user) "default-user")) | ||
| 450 | (should (string-equal (file-remote-p "/-:host:" 'host) "host")) | ||
| 451 | (should (string-equal (file-remote-p "/-:host:" 'localname) "")) | ||
| 452 | (should (string-equal (file-remote-p "/-:host:" 'hop) nil)) | ||
| 453 | |||
| 454 | ;; Expand `tramp-default-method' and `tramp-default-host'. | ||
| 455 | (should (string-equal | ||
| 456 | (file-remote-p "/-:user@:") | ||
| 457 | (format "/%s:%s@%s:" "default-method" "user" "default-host"))) | ||
| 458 | (should (string-equal (file-remote-p "/-:user@:" 'method) "default-method")) | ||
| 459 | (should (string-equal (file-remote-p "/-:user@:" 'user) "user")) | ||
| 460 | (should (string-equal (file-remote-p "/-:user@:" 'host) "default-host")) | ||
| 461 | (should (string-equal (file-remote-p "/-:user@:" 'localname) "")) | ||
| 462 | (should (string-equal (file-remote-p "/-:user@:" 'hop) nil)) | ||
| 463 | |||
| 464 | ;; Expand `tramp-default-method'. | ||
| 465 | (should (string-equal | ||
| 466 | (file-remote-p "/-:user@host:") | ||
| 467 | (format "/%s:%s@%s:" "default-method" "user" "host"))) | ||
| 468 | (should (string-equal | ||
| 469 | (file-remote-p "/-:user@host:" 'method) "default-method")) | ||
| 470 | (should (string-equal (file-remote-p "/-:user@host:" 'user) "user")) | ||
| 471 | (should (string-equal (file-remote-p "/-:user@host:" 'host) "host")) | ||
| 472 | (should (string-equal (file-remote-p "/-:user@host:" 'localname) "")) | ||
| 473 | (should (string-equal (file-remote-p "/-:user@host:" 'hop) nil)) | ||
| 474 | |||
| 475 | ;; Expand `tramp-default-user'. | ||
| 476 | (should (string-equal | ||
| 477 | (file-remote-p "/method:host:") | ||
| 478 | (format "/%s:%s@%s:" "method" "default-user" "host"))) | ||
| 479 | (should (string-equal (file-remote-p "/method:host:" 'method) "method")) | ||
| 480 | (should (string-equal (file-remote-p "/method:host:" 'user) "default-user")) | ||
| 481 | (should (string-equal (file-remote-p "/method:host:" 'host) "host")) | ||
| 482 | (should (string-equal (file-remote-p "/method:host:" 'localname) "")) | ||
| 483 | (should (string-equal (file-remote-p "/method:host:" 'hop) nil)) | ||
| 484 | |||
| 485 | ;; Expand `tramp-default-host'. | ||
| 486 | (should (string-equal | ||
| 487 | (file-remote-p "/method:user@:") | ||
| 488 | (format "/%s:%s@%s:" "method" "user" "default-host"))) | ||
| 489 | (should (string-equal (file-remote-p "/method:user@:" 'method) "method")) | ||
| 490 | (should (string-equal (file-remote-p "/method:user@:" 'user) "user")) | ||
| 491 | (should (string-equal (file-remote-p "/method:user@:" 'host) | ||
| 492 | "default-host")) | ||
| 493 | (should (string-equal (file-remote-p "/method:user@:" 'localname) "")) | ||
| 494 | (should (string-equal (file-remote-p "/method:user@:" 'hop) nil)) | ||
| 495 | |||
| 496 | ;; No expansion. | ||
| 497 | (should (string-equal | ||
| 498 | (file-remote-p "/method:user@host:") | ||
| 499 | (format "/%s:%s@%s:" "method" "user" "host"))) | ||
| 500 | (should (string-equal | ||
| 501 | (file-remote-p "/method:user@host:" 'method) "method")) | ||
| 502 | (should (string-equal (file-remote-p "/method:user@host:" 'user) "user")) | ||
| 503 | (should (string-equal (file-remote-p "/method:user@host:" 'host) "host")) | ||
| 504 | (should (string-equal (file-remote-p "/method:user@host:" 'localname) "")) | ||
| 505 | (should (string-equal (file-remote-p "/method:user@host:" 'hop) nil)) | ||
| 506 | |||
| 507 | ;; No expansion. | ||
| 508 | (should (string-equal | ||
| 509 | (file-remote-p "/method:user@email@host:") | ||
| 510 | (format "/%s:%s@%s:" "method" "user@email" "host"))) | ||
| 511 | (should (string-equal | ||
| 512 | (file-remote-p "/method:user@email@host:" 'method) "method")) | ||
| 513 | (should (string-equal | ||
| 514 | (file-remote-p "/method:user@email@host:" 'user) "user@email")) | ||
| 515 | (should (string-equal | ||
| 516 | (file-remote-p "/method:user@email@host:" 'host) "host")) | ||
| 517 | (should (string-equal | ||
| 518 | (file-remote-p "/method:user@email@host:" 'localname) "")) | ||
| 519 | (should (string-equal | ||
| 520 | (file-remote-p "/method:user@email@host:" 'hop) nil)) | ||
| 521 | |||
| 522 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 523 | (should (string-equal | ||
| 524 | (file-remote-p "/-:host#1234:") | ||
| 525 | (format "/%s:%s@%s:" "default-method" "default-user" "host#1234"))) | ||
| 526 | (should (string-equal | ||
| 527 | (file-remote-p "/-:host#1234:" 'method) "default-method")) | ||
| 528 | (should (string-equal (file-remote-p "/-:host#1234:" 'user) "default-user")) | ||
| 529 | (should (string-equal (file-remote-p "/-:host#1234:" 'host) "host#1234")) | ||
| 530 | (should (string-equal (file-remote-p "/-:host#1234:" 'localname) "")) | ||
| 531 | (should (string-equal (file-remote-p "/-:host#1234:" 'hop) nil)) | ||
| 532 | |||
| 533 | ;; Expand `tramp-default-method'. | ||
| 534 | (should (string-equal | ||
| 535 | (file-remote-p "/-:user@host#1234:") | ||
| 536 | (format "/%s:%s@%s:" "default-method" "user" "host#1234"))) | ||
| 537 | (should (string-equal | ||
| 538 | (file-remote-p "/-:user@host#1234:" 'method) "default-method")) | ||
| 539 | (should (string-equal (file-remote-p "/-:user@host#1234:" 'user) "user")) | ||
| 540 | (should (string-equal | ||
| 541 | (file-remote-p "/-:user@host#1234:" 'host) "host#1234")) | ||
| 542 | (should (string-equal (file-remote-p "/-:user@host#1234:" 'localname) "")) | ||
| 543 | (should (string-equal (file-remote-p "/-:user@host#1234:" 'hop) nil)) | ||
| 544 | |||
| 545 | ;; Expand `tramp-default-user'. | ||
| 546 | (should (string-equal | ||
| 547 | (file-remote-p "/method:host#1234:") | ||
| 548 | (format "/%s:%s@%s:" "method" "default-user" "host#1234"))) | ||
| 549 | (should (string-equal | ||
| 550 | (file-remote-p "/method:host#1234:" 'method) "method")) | ||
| 551 | (should (string-equal | ||
| 552 | (file-remote-p "/method:host#1234:" 'user) "default-user")) | ||
| 553 | (should (string-equal | ||
| 554 | (file-remote-p "/method:host#1234:" 'host) "host#1234")) | ||
| 555 | (should (string-equal (file-remote-p "/method:host#1234:" 'localname) "")) | ||
| 556 | (should (string-equal (file-remote-p "/method:host#1234:" 'hop) nil)) | ||
| 557 | |||
| 558 | ;; No expansion. | ||
| 559 | (should (string-equal | ||
| 560 | (file-remote-p "/method:user@host#1234:") | ||
| 561 | (format "/%s:%s@%s:" "method" "user" "host#1234"))) | ||
| 562 | (should (string-equal | ||
| 563 | (file-remote-p "/method:user@host#1234:" 'method) "method")) | ||
| 564 | (should (string-equal | ||
| 565 | (file-remote-p "/method:user@host#1234:" 'user) "user")) | ||
| 566 | (should (string-equal | ||
| 567 | (file-remote-p "/method:user@host#1234:" 'host) "host#1234")) | ||
| 568 | (should (string-equal | ||
| 569 | (file-remote-p "/method:user@host#1234:" 'localname) "")) | ||
| 570 | (should (string-equal | ||
| 571 | (file-remote-p "/method:user@host#1234:" 'hop) nil)) | ||
| 572 | |||
| 573 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 574 | (should (string-equal | ||
| 575 | (file-remote-p "/-:1.2.3.4:") | ||
| 576 | (format "/%s:%s@%s:" "default-method" "default-user" "1.2.3.4"))) | ||
| 577 | (should (string-equal | ||
| 578 | (file-remote-p "/-:1.2.3.4:" 'method) "default-method")) | ||
| 579 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'user) "default-user")) | ||
| 580 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'host) "1.2.3.4")) | ||
| 581 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'localname) "")) | ||
| 582 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'hop) nil)) | ||
| 583 | |||
| 584 | ;; Expand `tramp-default-method'. | ||
| 585 | (should (string-equal | ||
| 586 | (file-remote-p "/-:user@1.2.3.4:") | ||
| 587 | (format "/%s:%s@%s:" "default-method" "user" "1.2.3.4"))) | ||
| 588 | (should (string-equal | ||
| 589 | (file-remote-p "/-:user@1.2.3.4:" 'method) "default-method")) | ||
| 590 | (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'user) "user")) | ||
| 591 | (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'host) "1.2.3.4")) | ||
| 592 | (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'localname) "")) | ||
| 593 | (should (string-equal (file-remote-p "/-:user@1.2.3.4:" 'hop) nil)) | ||
| 594 | |||
| 595 | ;; Expand `tramp-default-user'. | ||
| 596 | (should (string-equal | ||
| 597 | (file-remote-p "/method:1.2.3.4:") | ||
| 598 | (format "/%s:%s@%s:" "method" "default-user" "1.2.3.4"))) | ||
| 599 | (should (string-equal (file-remote-p "/method:1.2.3.4:" 'method) "method")) | ||
| 600 | (should (string-equal | ||
| 601 | (file-remote-p "/method:1.2.3.4:" 'user) "default-user")) | ||
| 602 | (should (string-equal (file-remote-p "/method:1.2.3.4:" 'host) "1.2.3.4")) | ||
| 603 | (should (string-equal (file-remote-p "/method:1.2.3.4:" 'localname) "")) | ||
| 604 | (should (string-equal (file-remote-p "/method:1.2.3.4:" 'hop) nil)) | ||
| 605 | |||
| 606 | ;; No expansion. | ||
| 607 | (should (string-equal | ||
| 608 | (file-remote-p "/method:user@1.2.3.4:") | ||
| 609 | (format "/%s:%s@%s:" "method" "user" "1.2.3.4"))) | ||
| 610 | (should (string-equal | ||
| 611 | (file-remote-p "/method:user@1.2.3.4:" 'method) "method")) | ||
| 612 | (should (string-equal (file-remote-p "/method:user@1.2.3.4:" 'user) "user")) | ||
| 613 | (should (string-equal | ||
| 614 | (file-remote-p "/method:user@1.2.3.4:" 'host) "1.2.3.4")) | ||
| 615 | (should (string-equal | ||
| 616 | (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) | ||
| 617 | (should (string-equal | ||
| 618 | (file-remote-p "/method:user@1.2.3.4:" 'hop) nil)) | ||
| 619 | |||
| 620 | ;; Expand `tramp-default-method', `tramp-default-user' and | ||
| 621 | ;; `tramp-default-host'. | ||
| 622 | (should (string-equal | ||
| 623 | (file-remote-p "/-:[]:") | ||
| 624 | (format | ||
| 625 | "/%s:%s@%s:" "default-method" "default-user" "default-host"))) | ||
| 626 | (should (string-equal (file-remote-p "/-:[]:" 'method) "default-method")) | ||
| 627 | (should (string-equal (file-remote-p "/-:[]:" 'user) "default-user")) | ||
| 628 | (should (string-equal (file-remote-p "/-:[]:" 'host) "default-host")) | ||
| 629 | (should (string-equal (file-remote-p "/-:[]:" 'localname) "")) | ||
| 630 | (should (string-equal (file-remote-p "/-:[]:" 'hop) nil)) | ||
| 631 | |||
| 632 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 633 | (let ((tramp-default-host "::1")) | ||
| 634 | (should (string-equal | ||
| 635 | (file-remote-p "/-:[]:") | ||
| 636 | (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) | ||
| 637 | (should (string-equal (file-remote-p "/-:[]:" 'method) "default-method")) | ||
| 638 | (should (string-equal (file-remote-p "/-:[]:" 'user) "default-user")) | ||
| 639 | (should (string-equal (file-remote-p "/-:[]:" 'host) "::1")) | ||
| 640 | (should (string-equal (file-remote-p "/-:[]:" 'localname) "")) | ||
| 641 | (should (string-equal (file-remote-p "/-:[]:" 'hop) nil))) | ||
| 642 | |||
| 643 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 644 | (should (string-equal | ||
| 645 | (file-remote-p "/-:[::1]:") | ||
| 646 | (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) | ||
| 647 | (should (string-equal (file-remote-p "/-:[::1]:" 'method) "default-method")) | ||
| 648 | (should (string-equal (file-remote-p "/-:[::1]:" 'user) "default-user")) | ||
| 649 | (should (string-equal (file-remote-p "/-:[::1]:" 'host) "::1")) | ||
| 650 | (should (string-equal (file-remote-p "/-:[::1]:" 'localname) "")) | ||
| 651 | (should (string-equal (file-remote-p "/-:[::1]:" 'hop) nil)) | ||
| 652 | |||
| 653 | ;; Expand `tramp-default-method'. | ||
| 654 | (should (string-equal | ||
| 655 | (file-remote-p "/-:user@[::1]:") | ||
| 656 | (format "/%s:%s@%s:" "default-method" "user" "[::1]"))) | ||
| 657 | (should (string-equal | ||
| 658 | (file-remote-p "/-:user@[::1]:" 'method) "default-method")) | ||
| 659 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'user) "user")) | ||
| 660 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'host) "::1")) | ||
| 661 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'localname) "")) | ||
| 662 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'hop) nil)) | ||
| 663 | |||
| 664 | ;; Expand `tramp-default-user'. | ||
| 665 | (should (string-equal | ||
| 666 | (file-remote-p "/method:[::1]:") | ||
| 667 | (format "/%s:%s@%s:" "method" "default-user" "[::1]"))) | ||
| 668 | (should (string-equal (file-remote-p "/method:[::1]:" 'method) "method")) | ||
| 669 | (should (string-equal | ||
| 670 | (file-remote-p "/method:[::1]:" 'user) "default-user")) | ||
| 671 | (should (string-equal (file-remote-p "/method:[::1]:" 'host) "::1")) | ||
| 672 | (should (string-equal (file-remote-p "/method:[::1]:" 'localname) "")) | ||
| 673 | (should (string-equal (file-remote-p "/method:[::1]:" 'hop) nil)) | ||
| 674 | |||
| 675 | ;; No expansion. | ||
| 676 | (should (string-equal | ||
| 677 | (file-remote-p "/method:user@[::1]:") | ||
| 678 | (format "/%s:%s@%s:" "method" "user" "[::1]"))) | ||
| 679 | (should (string-equal | ||
| 680 | (file-remote-p "/method:user@[::1]:" 'method) "method")) | ||
| 681 | (should (string-equal (file-remote-p "/method:user@[::1]:" 'user) "user")) | ||
| 682 | (should (string-equal (file-remote-p "/method:user@[::1]:" 'host) "::1")) | ||
| 683 | (should (string-equal | ||
| 684 | (file-remote-p "/method:user@[::1]:" 'localname) "")) | ||
| 685 | (should (string-equal (file-remote-p "/method:user@[::1]:" 'hop) nil)) | ||
| 686 | |||
| 687 | ;; Local file name part. | ||
| 688 | (should (string-equal (file-remote-p "/-:host:/:" 'localname) "/:")) | ||
| 689 | (should (string-equal (file-remote-p "/method:::" 'localname) ":")) | ||
| 690 | (should (string-equal (file-remote-p "/method:: " 'localname) " ")) | ||
| 691 | (should (string-equal (file-remote-p "/method::file" 'localname) "file")) | ||
| 692 | (should (string-equal | ||
| 693 | (file-remote-p "/method::/path/to/file" 'localname) | ||
| 694 | "/path/to/file")) | ||
| 695 | |||
| 696 | ;; Multihop. | ||
| 697 | (should | ||
| 698 | (string-equal | ||
| 699 | (file-remote-p "/method1:user1@host1|method2:user2@host2:/path/to/file") | ||
| 700 | (format "/%s:%s@%s|%s:%s@%s:" | ||
| 701 | "method1" "user1" "host1" "method2" "user2" "host2"))) | ||
| 702 | (should | ||
| 703 | (string-equal | ||
| 704 | (file-remote-p | ||
| 705 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'method) | ||
| 706 | "method2")) | ||
| 707 | (should | ||
| 708 | (string-equal | ||
| 709 | (file-remote-p | ||
| 710 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'user) | ||
| 711 | "user2")) | ||
| 712 | (should | ||
| 713 | (string-equal | ||
| 714 | (file-remote-p | ||
| 715 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'host) | ||
| 716 | "host2")) | ||
| 717 | (should | ||
| 718 | (string-equal | ||
| 719 | (file-remote-p | ||
| 720 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'localname) | ||
| 721 | "/path/to/file")) | ||
| 722 | (should | ||
| 723 | (string-equal | ||
| 724 | (file-remote-p | ||
| 725 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'hop) | ||
| 726 | (format "%s:%s@%s|" | ||
| 727 | "method1" "user1" "host1"))) | ||
| 728 | 455 | ||
| 729 | (should | 456 | ;; Expand `tramp-default-user' and `tramp-default-host'. |
| 730 | (string-equal | 457 | (should |
| 731 | (file-remote-p | 458 | (string-equal |
| 732 | (concat | 459 | (file-remote-p "/method::") |
| 733 | "/method1:user1@host1" | 460 | (format "/%s:%s@%s:" "method" "default-user" "default-host"))) |
| 734 | "|method2:user2@host2" | 461 | (should (string-equal (file-remote-p "/method::" 'method) "method")) |
| 735 | "|method3:user3@host3:/path/to/file")) | 462 | (should |
| 736 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | 463 | (string-equal (file-remote-p "/method::" 'user) "default-user")) |
| 737 | "method1" "user1" "host1" | 464 | (should |
| 738 | "method2" "user2" "host2" | 465 | (string-equal (file-remote-p "/method::" 'host) "default-host")) |
| 739 | "method3" "user3" "host3"))) | 466 | (should (string-equal (file-remote-p "/method::" 'localname) "")) |
| 740 | (should | 467 | (should (string-equal (file-remote-p "/method::" 'hop) nil)) |
| 741 | (string-equal | 468 | |
| 742 | (file-remote-p | 469 | ;; Expand `tramp-default-method' and `tramp-default-user'. |
| 743 | (concat | 470 | (should |
| 744 | "/method1:user1@host1" | 471 | (string-equal |
| 745 | "|method2:user2@host2" | 472 | (file-remote-p "/-:host:") |
| 746 | "|method3:user3@host3:/path/to/file") | 473 | (format "/%s:%s@%s:" "default-method" "default-user" "host"))) |
| 747 | 'method) | 474 | (should |
| 748 | "method3")) | 475 | (string-equal (file-remote-p "/-:host:" 'method) "default-method")) |
| 749 | (should | 476 | (should |
| 750 | (string-equal | 477 | (string-equal (file-remote-p "/-:host:" 'user) "default-user")) |
| 751 | (file-remote-p | 478 | (should (string-equal (file-remote-p "/-:host:" 'host) "host")) |
| 752 | (concat | 479 | (should (string-equal (file-remote-p "/-:host:" 'localname) "")) |
| 753 | "/method1:user1@host1" | 480 | (should (string-equal (file-remote-p "/-:host:" 'hop) nil)) |
| 754 | "|method2:user2@host2" | 481 | |
| 755 | "|method3:user3@host3:/path/to/file") | 482 | ;; Expand `tramp-default-method' and `tramp-default-host'. |
| 756 | 'user) | 483 | (should |
| 757 | "user3")) | 484 | (string-equal |
| 758 | (should | 485 | (file-remote-p "/-:user@:") |
| 759 | (string-equal | 486 | (format "/%s:%s@%s:" "default-method" "user" "default-host"))) |
| 760 | (file-remote-p | 487 | (should |
| 761 | (concat | 488 | (string-equal (file-remote-p "/-:user@:" 'method) "default-method")) |
| 762 | "/method1:user1@host1" | 489 | (should (string-equal (file-remote-p "/-:user@:" 'user) "user")) |
| 763 | "|method2:user2@host2" | 490 | (should |
| 764 | "|method3:user3@host3:/path/to/file") | 491 | (string-equal (file-remote-p "/-:user@:" 'host) "default-host")) |
| 765 | 'host) | 492 | (should (string-equal (file-remote-p "/-:user@:" 'localname) "")) |
| 766 | "host3")) | 493 | (should (string-equal (file-remote-p "/-:user@:" 'hop) nil)) |
| 767 | (should | 494 | |
| 768 | (string-equal | 495 | ;; Expand `tramp-default-method'. |
| 769 | (file-remote-p | 496 | (should (string-equal |
| 770 | (concat | 497 | (file-remote-p "/-:user@host:") |
| 771 | "/method1:user1@host1" | 498 | (format "/%s:%s@%s:" "default-method" "user" "host"))) |
| 772 | "|method2:user2@host2" | 499 | (should (string-equal |
| 773 | "|method3:user3@host3:/path/to/file") | 500 | (file-remote-p "/-:user@host:" 'method) "default-method")) |
| 774 | 'localname) | 501 | (should (string-equal (file-remote-p "/-:user@host:" 'user) "user")) |
| 775 | "/path/to/file")) | 502 | (should (string-equal (file-remote-p "/-:user@host:" 'host) "host")) |
| 776 | (should | 503 | (should (string-equal (file-remote-p "/-:user@host:" 'localname) "")) |
| 777 | (string-equal | 504 | (should (string-equal (file-remote-p "/-:user@host:" 'hop) nil)) |
| 778 | (file-remote-p | 505 | |
| 779 | (concat | 506 | ;; Expand `tramp-default-user'. |
| 780 | "/method1:user1@host1" | 507 | (should (string-equal |
| 781 | "|method2:user2@host2" | 508 | (file-remote-p "/method:host:") |
| 782 | "|method3:user3@host3:/path/to/file") | 509 | (format "/%s:%s@%s:" "method" "default-user" "host"))) |
| 783 | 'hop) | 510 | (should |
| 784 | (format "%s:%s@%s|%s:%s@%s|" | 511 | (string-equal (file-remote-p "/method:host:" 'method) "method")) |
| 785 | "method1" "user1" "host1" "method2" "user2" "host2"))) | 512 | (should |
| 786 | 513 | (string-equal (file-remote-p "/method:host:" 'user) "default-user")) | |
| 787 | ;; Expand `tramp-default-method-alist'. | 514 | (should (string-equal (file-remote-p "/method:host:" 'host) "host")) |
| 788 | (add-to-list 'tramp-default-method-alist '("host1" "user1" "method1")) | 515 | (should (string-equal (file-remote-p "/method:host:" 'localname) "")) |
| 789 | (add-to-list 'tramp-default-method-alist '("host2" "user2" "method2")) | 516 | (should (string-equal (file-remote-p "/method:host:" 'hop) nil)) |
| 790 | (add-to-list 'tramp-default-method-alist '("host3" "user3" "method3")) | 517 | |
| 791 | (should | 518 | ;; Expand `tramp-default-host'. |
| 792 | (string-equal | 519 | (should |
| 793 | (file-remote-p | 520 | (string-equal |
| 794 | (concat | 521 | (file-remote-p "/method:user@:") |
| 795 | "/-:user1@host1" | 522 | (format "/%s:%s@%s:" "method" "user" "default-host"))) |
| 796 | "|-:user2@host2" | 523 | (should |
| 797 | "|-:user3@host3:/path/to/file")) | 524 | (string-equal (file-remote-p "/method:user@:" 'method) "method")) |
| 798 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | 525 | (should (string-equal (file-remote-p "/method:user@:" 'user) "user")) |
| 799 | "method1" "user1" "host1" | 526 | (should |
| 800 | "method2" "user2" "host2" | 527 | (string-equal (file-remote-p "/method:user@:" 'host) "default-host")) |
| 801 | "method3" "user3" "host3"))) | 528 | (should (string-equal (file-remote-p "/method:user@:" 'localname) "")) |
| 802 | 529 | (should (string-equal (file-remote-p "/method:user@:" 'hop) nil)) | |
| 803 | ;; Expand `tramp-default-user-alist'. | 530 | |
| 804 | (add-to-list 'tramp-default-user-alist '("method1" "host1" "user1")) | 531 | ;; No expansion. |
| 805 | (add-to-list 'tramp-default-user-alist '("method2" "host2" "user2")) | 532 | (should (string-equal |
| 806 | (add-to-list 'tramp-default-user-alist '("method3" "host3" "user3")) | 533 | (file-remote-p "/method:user@host:") |
| 807 | (should | 534 | (format "/%s:%s@%s:" "method" "user" "host"))) |
| 808 | (string-equal | 535 | (should (string-equal |
| 809 | (file-remote-p | 536 | (file-remote-p "/method:user@host:" 'method) "method")) |
| 810 | (concat | 537 | (should |
| 811 | "/method1:host1" | 538 | (string-equal (file-remote-p "/method:user@host:" 'user) "user")) |
| 812 | "|method2:host2" | 539 | (should |
| 813 | "|method3:host3:/path/to/file")) | 540 | (string-equal (file-remote-p "/method:user@host:" 'host) "host")) |
| 814 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | 541 | (should |
| 815 | "method1" "user1" "host1" | 542 | (string-equal (file-remote-p "/method:user@host:" 'localname) "")) |
| 816 | "method2" "user2" "host2" | 543 | (should (string-equal (file-remote-p "/method:user@host:" 'hop) nil)) |
| 817 | "method3" "user3" "host3"))) | 544 | |
| 818 | 545 | ;; No expansion. | |
| 819 | ;; Expand `tramp-default-host-alist'. | 546 | (should (string-equal |
| 820 | (add-to-list 'tramp-default-host-alist '("method1" "user1" "host1")) | 547 | (file-remote-p "/method:user@email@host:") |
| 821 | (add-to-list 'tramp-default-host-alist '("method2" "user2" "host2")) | 548 | (format "/%s:%s@%s:" "method" "user@email" "host"))) |
| 822 | (add-to-list 'tramp-default-host-alist '("method3" "user3" "host3")) | 549 | (should (string-equal |
| 823 | (should | 550 | (file-remote-p "/method:user@email@host:" 'method) "method")) |
| 824 | (string-equal | 551 | (should |
| 825 | (file-remote-p | 552 | (string-equal |
| 826 | (concat | 553 | (file-remote-p "/method:user@email@host:" 'user) "user@email")) |
| 827 | "/method1:user1@" | 554 | (should (string-equal |
| 828 | "|method2:user2@" | 555 | (file-remote-p "/method:user@email@host:" 'host) "host")) |
| 829 | "|method3:user3@:/path/to/file")) | 556 | (should (string-equal |
| 830 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | 557 | (file-remote-p "/method:user@email@host:" 'localname) "")) |
| 831 | "method1" "user1" "host1" | 558 | (should (string-equal |
| 832 | "method2" "user2" "host2" | 559 | (file-remote-p "/method:user@email@host:" 'hop) nil)) |
| 833 | "method3" "user3" "host3"))) | 560 | |
| 834 | 561 | ;; Expand `tramp-default-method' and `tramp-default-user'. | |
| 835 | ;; Ad-hoc user name and host name expansion. | 562 | (should |
| 836 | (setq tramp-default-method-alist nil | 563 | (string-equal |
| 837 | tramp-default-user-alist nil | 564 | (file-remote-p "/-:host#1234:") |
| 838 | tramp-default-host-alist nil) | 565 | (format "/%s:%s@%s:" "default-method" "default-user" "host#1234"))) |
| 839 | (should | 566 | (should (string-equal |
| 840 | (string-equal | 567 | (file-remote-p "/-:host#1234:" 'method) "default-method")) |
| 841 | (file-remote-p | 568 | (should |
| 842 | (concat | 569 | (string-equal (file-remote-p "/-:host#1234:" 'user) "default-user")) |
| 843 | "/method1:user1@host1" | 570 | (should |
| 844 | "|method2:user2@" | 571 | (string-equal (file-remote-p "/-:host#1234:" 'host) "host#1234")) |
| 845 | "|method3:user3@:/path/to/file")) | 572 | (should (string-equal (file-remote-p "/-:host#1234:" 'localname) "")) |
| 846 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | 573 | (should (string-equal (file-remote-p "/-:host#1234:" 'hop) nil)) |
| 847 | "method1" "user1" "host1" | 574 | |
| 848 | "method2" "user2" "host1" | 575 | ;; Expand `tramp-default-method'. |
| 849 | "method3" "user3" "host1"))) | 576 | (should (string-equal |
| 850 | (should | 577 | (file-remote-p "/-:user@host#1234:") |
| 851 | (string-equal | 578 | (format "/%s:%s@%s:" "default-method" "user" "host#1234"))) |
| 852 | (file-remote-p | 579 | (should |
| 853 | (concat | 580 | (string-equal |
| 854 | "/method1:%u@%h" | 581 | (file-remote-p "/-:user@host#1234:" 'method) "default-method")) |
| 855 | "|method2:user2@host2" | 582 | (should |
| 856 | "|method3:%u@%h" | 583 | (string-equal (file-remote-p "/-:user@host#1234:" 'user) "user")) |
| 857 | "|method4:user4%domain4@host4#1234:/path/to/file")) | 584 | (should |
| 858 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s|%s:%s@%s:" | 585 | (string-equal |
| 859 | "method1" "user2" "host2" | 586 | (file-remote-p "/-:user@host#1234:" 'host) "host#1234")) |
| 860 | "method2" "user2" "host2" | 587 | (should |
| 861 | "method3" "user4" "host4" | 588 | (string-equal (file-remote-p "/-:user@host#1234:" 'localname) "")) |
| 862 | "method4" "user4%domain4" "host4#1234"))))) | 589 | (should (string-equal (file-remote-p "/-:user@host#1234:" 'hop) nil)) |
| 590 | |||
| 591 | ;; Expand `tramp-default-user'. | ||
| 592 | (should (string-equal | ||
| 593 | (file-remote-p "/method:host#1234:") | ||
| 594 | (format "/%s:%s@%s:" "method" "default-user" "host#1234"))) | ||
| 595 | (should (string-equal | ||
| 596 | (file-remote-p "/method:host#1234:" 'method) "method")) | ||
| 597 | (should (string-equal | ||
| 598 | (file-remote-p "/method:host#1234:" 'user) "default-user")) | ||
| 599 | (should (string-equal | ||
| 600 | (file-remote-p "/method:host#1234:" 'host) "host#1234")) | ||
| 601 | (should | ||
| 602 | (string-equal (file-remote-p "/method:host#1234:" 'localname) "")) | ||
| 603 | (should (string-equal (file-remote-p "/method:host#1234:" 'hop) nil)) | ||
| 604 | |||
| 605 | ;; No expansion. | ||
| 606 | (should (string-equal | ||
| 607 | (file-remote-p "/method:user@host#1234:") | ||
| 608 | (format "/%s:%s@%s:" "method" "user" "host#1234"))) | ||
| 609 | (should (string-equal | ||
| 610 | (file-remote-p "/method:user@host#1234:" 'method) "method")) | ||
| 611 | (should (string-equal | ||
| 612 | (file-remote-p "/method:user@host#1234:" 'user) "user")) | ||
| 613 | (should (string-equal | ||
| 614 | (file-remote-p "/method:user@host#1234:" 'host) "host#1234")) | ||
| 615 | (should (string-equal | ||
| 616 | (file-remote-p "/method:user@host#1234:" 'localname) "")) | ||
| 617 | (should (string-equal | ||
| 618 | (file-remote-p "/method:user@host#1234:" 'hop) nil)) | ||
| 619 | |||
| 620 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 621 | (should | ||
| 622 | (string-equal | ||
| 623 | (file-remote-p "/-:1.2.3.4:") | ||
| 624 | (format "/%s:%s@%s:" "default-method" "default-user" "1.2.3.4"))) | ||
| 625 | (should | ||
| 626 | (string-equal | ||
| 627 | (file-remote-p "/-:1.2.3.4:" 'method) "default-method")) | ||
| 628 | (should | ||
| 629 | (string-equal (file-remote-p "/-:1.2.3.4:" 'user) "default-user")) | ||
| 630 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'host) "1.2.3.4")) | ||
| 631 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'localname) "")) | ||
| 632 | (should (string-equal (file-remote-p "/-:1.2.3.4:" 'hop) nil)) | ||
| 633 | |||
| 634 | ;; Expand `tramp-default-method'. | ||
| 635 | (should (string-equal | ||
| 636 | (file-remote-p "/-:user@1.2.3.4:") | ||
| 637 | (format "/%s:%s@%s:" "default-method" "user" "1.2.3.4"))) | ||
| 638 | (should (string-equal | ||
| 639 | (file-remote-p "/-:user@1.2.3.4:" 'method) "default-method")) | ||
| 640 | (should | ||
| 641 | (string-equal (file-remote-p "/-:user@1.2.3.4:" 'user) "user")) | ||
| 642 | (should | ||
| 643 | (string-equal (file-remote-p "/-:user@1.2.3.4:" 'host) "1.2.3.4")) | ||
| 644 | (should | ||
| 645 | (string-equal (file-remote-p "/-:user@1.2.3.4:" 'localname) "")) | ||
| 646 | (should | ||
| 647 | (string-equal (file-remote-p "/-:user@1.2.3.4:" 'hop) nil)) | ||
| 648 | |||
| 649 | ;; Expand `tramp-default-user'. | ||
| 650 | (should (string-equal | ||
| 651 | (file-remote-p "/method:1.2.3.4:") | ||
| 652 | (format "/%s:%s@%s:" "method" "default-user" "1.2.3.4"))) | ||
| 653 | (should | ||
| 654 | (string-equal (file-remote-p "/method:1.2.3.4:" 'method) "method")) | ||
| 655 | (should (string-equal | ||
| 656 | (file-remote-p "/method:1.2.3.4:" 'user) "default-user")) | ||
| 657 | (should | ||
| 658 | (string-equal (file-remote-p "/method:1.2.3.4:" 'host) "1.2.3.4")) | ||
| 659 | (should | ||
| 660 | (string-equal (file-remote-p "/method:1.2.3.4:" 'localname) "")) | ||
| 661 | (should (string-equal (file-remote-p "/method:1.2.3.4:" 'hop) nil)) | ||
| 662 | |||
| 663 | ;; No expansion. | ||
| 664 | (should (string-equal | ||
| 665 | (file-remote-p "/method:user@1.2.3.4:") | ||
| 666 | (format "/%s:%s@%s:" "method" "user" "1.2.3.4"))) | ||
| 667 | (should (string-equal | ||
| 668 | (file-remote-p "/method:user@1.2.3.4:" 'method) "method")) | ||
| 669 | (should | ||
| 670 | (string-equal (file-remote-p "/method:user@1.2.3.4:" 'user) "user")) | ||
| 671 | (should (string-equal | ||
| 672 | (file-remote-p "/method:user@1.2.3.4:" 'host) "1.2.3.4")) | ||
| 673 | (should (string-equal | ||
| 674 | (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) | ||
| 675 | (should (string-equal | ||
| 676 | (file-remote-p "/method:user@1.2.3.4:" 'hop) nil)) | ||
| 677 | |||
| 678 | ;; Expand `tramp-default-method', `tramp-default-user' and | ||
| 679 | ;; `tramp-default-host'. | ||
| 680 | (should | ||
| 681 | (string-equal | ||
| 682 | (file-remote-p "/-:[]:") | ||
| 683 | (format | ||
| 684 | "/%s:%s@%s:" "default-method" "default-user" "default-host"))) | ||
| 685 | (should | ||
| 686 | (string-equal (file-remote-p "/-:[]:" 'method) "default-method")) | ||
| 687 | (should (string-equal (file-remote-p "/-:[]:" 'user) "default-user")) | ||
| 688 | (should (string-equal (file-remote-p "/-:[]:" 'host) "default-host")) | ||
| 689 | (should (string-equal (file-remote-p "/-:[]:" 'localname) "")) | ||
| 690 | (should (string-equal (file-remote-p "/-:[]:" 'hop) nil)) | ||
| 691 | |||
| 692 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 693 | (let ((tramp-default-host "::1")) | ||
| 694 | (should | ||
| 695 | (string-equal | ||
| 696 | (file-remote-p "/-:[]:") | ||
| 697 | (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) | ||
| 698 | (should | ||
| 699 | (string-equal (file-remote-p "/-:[]:" 'method) "default-method")) | ||
| 700 | (should | ||
| 701 | (string-equal (file-remote-p "/-:[]:" 'user) "default-user")) | ||
| 702 | (should (string-equal (file-remote-p "/-:[]:" 'host) "::1")) | ||
| 703 | (should (string-equal (file-remote-p "/-:[]:" 'localname) "")) | ||
| 704 | (should (string-equal (file-remote-p "/-:[]:" 'hop) nil))) | ||
| 705 | |||
| 706 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 707 | (should | ||
| 708 | (string-equal | ||
| 709 | (file-remote-p "/-:[::1]:") | ||
| 710 | (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) | ||
| 711 | (should | ||
| 712 | (string-equal (file-remote-p "/-:[::1]:" 'method) "default-method")) | ||
| 713 | (should | ||
| 714 | (string-equal (file-remote-p "/-:[::1]:" 'user) "default-user")) | ||
| 715 | (should (string-equal (file-remote-p "/-:[::1]:" 'host) "::1")) | ||
| 716 | (should (string-equal (file-remote-p "/-:[::1]:" 'localname) "")) | ||
| 717 | (should (string-equal (file-remote-p "/-:[::1]:" 'hop) nil)) | ||
| 718 | |||
| 719 | ;; Expand `tramp-default-method'. | ||
| 720 | (should (string-equal | ||
| 721 | (file-remote-p "/-:user@[::1]:") | ||
| 722 | (format "/%s:%s@%s:" "default-method" "user" "[::1]"))) | ||
| 723 | (should (string-equal | ||
| 724 | (file-remote-p "/-:user@[::1]:" 'method) "default-method")) | ||
| 725 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'user) "user")) | ||
| 726 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'host) "::1")) | ||
| 727 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'localname) "")) | ||
| 728 | (should (string-equal (file-remote-p "/-:user@[::1]:" 'hop) nil)) | ||
| 729 | |||
| 730 | ;; Expand `tramp-default-user'. | ||
| 731 | (should (string-equal | ||
| 732 | (file-remote-p "/method:[::1]:") | ||
| 733 | (format "/%s:%s@%s:" "method" "default-user" "[::1]"))) | ||
| 734 | (should | ||
| 735 | (string-equal (file-remote-p "/method:[::1]:" 'method) "method")) | ||
| 736 | (should (string-equal | ||
| 737 | (file-remote-p "/method:[::1]:" 'user) "default-user")) | ||
| 738 | (should (string-equal (file-remote-p "/method:[::1]:" 'host) "::1")) | ||
| 739 | (should (string-equal (file-remote-p "/method:[::1]:" 'localname) "")) | ||
| 740 | (should (string-equal (file-remote-p "/method:[::1]:" 'hop) nil)) | ||
| 741 | |||
| 742 | ;; No expansion. | ||
| 743 | (should (string-equal | ||
| 744 | (file-remote-p "/method:user@[::1]:") | ||
| 745 | (format "/%s:%s@%s:" "method" "user" "[::1]"))) | ||
| 746 | (should (string-equal | ||
| 747 | (file-remote-p "/method:user@[::1]:" 'method) "method")) | ||
| 748 | (should | ||
| 749 | (string-equal (file-remote-p "/method:user@[::1]:" 'user) "user")) | ||
| 750 | (should | ||
| 751 | (string-equal (file-remote-p "/method:user@[::1]:" 'host) "::1")) | ||
| 752 | (should (string-equal | ||
| 753 | (file-remote-p "/method:user@[::1]:" 'localname) "")) | ||
| 754 | (should (string-equal (file-remote-p "/method:user@[::1]:" 'hop) nil)) | ||
| 755 | |||
| 756 | ;; Local file name part. | ||
| 757 | (should (string-equal (file-remote-p "/-:host:/:" 'localname) "/:")) | ||
| 758 | (should (string-equal (file-remote-p "/method:::" 'localname) ":")) | ||
| 759 | (should (string-equal (file-remote-p "/method:: " 'localname) " ")) | ||
| 760 | (should | ||
| 761 | (string-equal (file-remote-p "/method::file" 'localname) "file")) | ||
| 762 | (should (string-equal | ||
| 763 | (file-remote-p "/method::/path/to/file" 'localname) | ||
| 764 | "/path/to/file")) | ||
| 765 | |||
| 766 | ;; Multihop. | ||
| 767 | (should | ||
| 768 | (string-equal | ||
| 769 | (file-remote-p | ||
| 770 | "/method1:user1@host1|method2:user2@host2:/path/to/file") | ||
| 771 | (format "/%s:%s@%s|%s:%s@%s:" | ||
| 772 | "method1" "user1" "host1" "method2" "user2" "host2"))) | ||
| 773 | (should | ||
| 774 | (string-equal | ||
| 775 | (file-remote-p | ||
| 776 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'method) | ||
| 777 | "method2")) | ||
| 778 | (should | ||
| 779 | (string-equal | ||
| 780 | (file-remote-p | ||
| 781 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'user) | ||
| 782 | "user2")) | ||
| 783 | (should | ||
| 784 | (string-equal | ||
| 785 | (file-remote-p | ||
| 786 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'host) | ||
| 787 | "host2")) | ||
| 788 | (should | ||
| 789 | (string-equal | ||
| 790 | (file-remote-p | ||
| 791 | "/method1:user1@host1|method2:user2@host2:/path/to/file" | ||
| 792 | 'localname) | ||
| 793 | "/path/to/file")) | ||
| 794 | (should | ||
| 795 | (string-equal | ||
| 796 | (file-remote-p | ||
| 797 | "/method1:user1@host1|method2:user2@host2:/path/to/file" 'hop) | ||
| 798 | (format "%s:%s@%s|" | ||
| 799 | "method1" "user1" "host1"))) | ||
| 800 | |||
| 801 | (should | ||
| 802 | (string-equal | ||
| 803 | (file-remote-p | ||
| 804 | (concat | ||
| 805 | "/method1:user1@host1" | ||
| 806 | "|method2:user2@host2" | ||
| 807 | "|method3:user3@host3:/path/to/file")) | ||
| 808 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | ||
| 809 | "method1" "user1" "host1" | ||
| 810 | "method2" "user2" "host2" | ||
| 811 | "method3" "user3" "host3"))) | ||
| 812 | (should | ||
| 813 | (string-equal | ||
| 814 | (file-remote-p | ||
| 815 | (concat | ||
| 816 | "/method1:user1@host1" | ||
| 817 | "|method2:user2@host2" | ||
| 818 | "|method3:user3@host3:/path/to/file") | ||
| 819 | 'method) | ||
| 820 | "method3")) | ||
| 821 | (should | ||
| 822 | (string-equal | ||
| 823 | (file-remote-p | ||
| 824 | (concat | ||
| 825 | "/method1:user1@host1" | ||
| 826 | "|method2:user2@host2" | ||
| 827 | "|method3:user3@host3:/path/to/file") | ||
| 828 | 'user) | ||
| 829 | "user3")) | ||
| 830 | (should | ||
| 831 | (string-equal | ||
| 832 | (file-remote-p | ||
| 833 | (concat | ||
| 834 | "/method1:user1@host1" | ||
| 835 | "|method2:user2@host2" | ||
| 836 | "|method3:user3@host3:/path/to/file") | ||
| 837 | 'host) | ||
| 838 | "host3")) | ||
| 839 | (should | ||
| 840 | (string-equal | ||
| 841 | (file-remote-p | ||
| 842 | (concat | ||
| 843 | "/method1:user1@host1" | ||
| 844 | "|method2:user2@host2" | ||
| 845 | "|method3:user3@host3:/path/to/file") | ||
| 846 | 'localname) | ||
| 847 | "/path/to/file")) | ||
| 848 | (should | ||
| 849 | (string-equal | ||
| 850 | (file-remote-p | ||
| 851 | (concat | ||
| 852 | "/method1:user1@host1" | ||
| 853 | "|method2:user2@host2" | ||
| 854 | "|method3:user3@host3:/path/to/file") | ||
| 855 | 'hop) | ||
| 856 | (format "%s:%s@%s|%s:%s@%s|" | ||
| 857 | "method1" "user1" "host1" "method2" "user2" "host2"))) | ||
| 858 | |||
| 859 | ;; Expand `tramp-default-method-alist'. | ||
| 860 | (add-to-list 'tramp-default-method-alist '("host1" "user1" "method1")) | ||
| 861 | (add-to-list 'tramp-default-method-alist '("host2" "user2" "method2")) | ||
| 862 | (add-to-list 'tramp-default-method-alist '("host3" "user3" "method3")) | ||
| 863 | (should | ||
| 864 | (string-equal | ||
| 865 | (file-remote-p | ||
| 866 | (concat | ||
| 867 | "/-:user1@host1" | ||
| 868 | "|-:user2@host2" | ||
| 869 | "|-:user3@host3:/path/to/file")) | ||
| 870 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | ||
| 871 | "method1" "user1" "host1" | ||
| 872 | "method2" "user2" "host2" | ||
| 873 | "method3" "user3" "host3"))) | ||
| 874 | |||
| 875 | ;; Expand `tramp-default-user-alist'. | ||
| 876 | (add-to-list 'tramp-default-user-alist '("method1" "host1" "user1")) | ||
| 877 | (add-to-list 'tramp-default-user-alist '("method2" "host2" "user2")) | ||
| 878 | (add-to-list 'tramp-default-user-alist '("method3" "host3" "user3")) | ||
| 879 | (should | ||
| 880 | (string-equal | ||
| 881 | (file-remote-p | ||
| 882 | (concat | ||
| 883 | "/method1:host1" | ||
| 884 | "|method2:host2" | ||
| 885 | "|method3:host3:/path/to/file")) | ||
| 886 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | ||
| 887 | "method1" "user1" "host1" | ||
| 888 | "method2" "user2" "host2" | ||
| 889 | "method3" "user3" "host3"))) | ||
| 890 | |||
| 891 | ;; Expand `tramp-default-host-alist'. | ||
| 892 | (add-to-list 'tramp-default-host-alist '("method1" "user1" "host1")) | ||
| 893 | (add-to-list 'tramp-default-host-alist '("method2" "user2" "host2")) | ||
| 894 | (add-to-list 'tramp-default-host-alist '("method3" "user3" "host3")) | ||
| 895 | (should | ||
| 896 | (string-equal | ||
| 897 | (file-remote-p | ||
| 898 | (concat | ||
| 899 | "/method1:user1@" | ||
| 900 | "|method2:user2@" | ||
| 901 | "|method3:user3@:/path/to/file")) | ||
| 902 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | ||
| 903 | "method1" "user1" "host1" | ||
| 904 | "method2" "user2" "host2" | ||
| 905 | "method3" "user3" "host3"))) | ||
| 906 | |||
| 907 | ;; Ad-hoc user name and host name expansion. | ||
| 908 | (setq tramp-default-method-alist nil | ||
| 909 | tramp-default-user-alist nil | ||
| 910 | tramp-default-host-alist nil) | ||
| 911 | (should | ||
| 912 | (string-equal | ||
| 913 | (file-remote-p | ||
| 914 | (concat | ||
| 915 | "/method1:user1@host1" | ||
| 916 | "|method2:user2@" | ||
| 917 | "|method3:user3@:/path/to/file")) | ||
| 918 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s:" | ||
| 919 | "method1" "user1" "host1" | ||
| 920 | "method2" "user2" "host1" | ||
| 921 | "method3" "user3" "host1"))) | ||
| 922 | (should | ||
| 923 | (string-equal | ||
| 924 | (file-remote-p | ||
| 925 | (concat | ||
| 926 | "/method1:%u@%h" | ||
| 927 | "|method2:user2@host2" | ||
| 928 | "|method3:%u@%h" | ||
| 929 | "|method4:user4%domain4@host4#1234:/path/to/file")) | ||
| 930 | (format "/%s:%s@%s|%s:%s@%s|%s:%s@%s|%s:%s@%s:" | ||
| 931 | "method1" "user2" "host2" | ||
| 932 | "method2" "user2" "host2" | ||
| 933 | "method3" "user4" "host4" | ||
| 934 | "method4" "user4%domain4" "host4#1234")))) | ||
| 935 | |||
| 936 | ;; Exit. | ||
| 937 | (tramp-change-syntax syntax)))) | ||
| 863 | 938 | ||
| 864 | (ert-deftest tramp-test02-file-name-dissect-simplified () | 939 | (ert-deftest tramp-test02-file-name-dissect-simplified () |
| 865 | "Check simplified file name components." | 940 | "Check simplified file name components." |
| @@ -1853,6 +1928,8 @@ properly. BODY shall not contain a timeout." | |||
| 1853 | 1928 | ||
| 1854 | (ert-deftest tramp-test03-file-name-defaults () | 1929 | (ert-deftest tramp-test03-file-name-defaults () |
| 1855 | "Check default values for some methods." | 1930 | "Check default values for some methods." |
| 1931 | (skip-unless (eq tramp-syntax 'default)) | ||
| 1932 | |||
| 1856 | ;; Default values in tramp-adb.el. | 1933 | ;; Default values in tramp-adb.el. |
| 1857 | (when (assoc "adb" tramp-methods) | 1934 | (when (assoc "adb" tramp-methods) |
| 1858 | (should (string-equal (file-remote-p "/adb::" 'host) ""))) | 1935 | (should (string-equal (file-remote-p "/adb::" 'host) ""))) |
| @@ -1882,6 +1959,7 @@ properly. BODY shall not contain a timeout." | |||
| 1882 | ;; The following test is inspired by Bug#30946. | 1959 | ;; The following test is inspired by Bug#30946. |
| 1883 | (ert-deftest tramp-test03-file-name-host-rules () | 1960 | (ert-deftest tramp-test03-file-name-host-rules () |
| 1884 | "Check host name rules for host-less methods." | 1961 | "Check host name rules for host-less methods." |
| 1962 | (skip-unless (eq tramp-syntax 'default)) | ||
| 1885 | (skip-unless (tramp--test-enabled)) | 1963 | (skip-unless (tramp--test-enabled)) |
| 1886 | (skip-unless (tramp--test-sh-p)) | 1964 | (skip-unless (tramp--test-sh-p)) |
| 1887 | 1965 | ||
| @@ -1906,6 +1984,7 @@ properly. BODY shall not contain a timeout." | |||
| 1906 | 1984 | ||
| 1907 | (ert-deftest tramp-test03-file-name-method-rules () | 1985 | (ert-deftest tramp-test03-file-name-method-rules () |
| 1908 | "Check file name rules for some methods." | 1986 | "Check file name rules for some methods." |
| 1987 | (skip-unless (eq tramp-syntax 'default)) | ||
| 1909 | (skip-unless (tramp--test-enabled)) | 1988 | (skip-unless (tramp--test-enabled)) |
| 1910 | 1989 | ||
| 1911 | ;; Multi hops are allowed for inline methods only. | 1990 | ;; Multi hops are allowed for inline methods only. |
| @@ -1928,6 +2007,8 @@ properly. BODY shall not contain a timeout." | |||
| 1928 | 2007 | ||
| 1929 | (ert-deftest tramp-test04-substitute-in-file-name () | 2008 | (ert-deftest tramp-test04-substitute-in-file-name () |
| 1930 | "Check `substitute-in-file-name'." | 2009 | "Check `substitute-in-file-name'." |
| 2010 | (skip-unless (eq tramp-syntax 'default)) | ||
| 2011 | |||
| 1931 | ;; Suppress method name check. | 2012 | ;; Suppress method name check. |
| 1932 | (let ((tramp-methods (cons '("method") tramp-methods))) | 2013 | (let ((tramp-methods (cons '("method") tramp-methods))) |
| 1933 | (should | 2014 | (should |
| @@ -2023,6 +2104,8 @@ properly. BODY shall not contain a timeout." | |||
| 2023 | 2104 | ||
| 2024 | (ert-deftest tramp-test05-expand-file-name () | 2105 | (ert-deftest tramp-test05-expand-file-name () |
| 2025 | "Check `expand-file-name'." | 2106 | "Check `expand-file-name'." |
| 2107 | (skip-unless (eq tramp-syntax 'default)) | ||
| 2108 | |||
| 2026 | ;; Suppress method name check. | 2109 | ;; Suppress method name check. |
| 2027 | (let ((tramp-methods (cons '("method") tramp-methods))) | 2110 | (let ((tramp-methods (cons '("method") tramp-methods))) |
| 2028 | (should | 2111 | (should |
| @@ -2085,6 +2168,8 @@ properly. BODY shall not contain a timeout." | |||
| 2085 | "Check `directory-file-name'. | 2168 | "Check `directory-file-name'. |
| 2086 | This checks also `file-name-as-directory', `file-name-directory', | 2169 | This checks also `file-name-as-directory', `file-name-directory', |
| 2087 | `file-name-nondirectory' and `unhandled-file-name-directory'." | 2170 | `file-name-nondirectory' and `unhandled-file-name-directory'." |
| 2171 | (skip-unless (eq tramp-syntax 'default)) | ||
| 2172 | |||
| 2088 | ;; Suppress method name check. | 2173 | ;; Suppress method name check. |
| 2089 | (let ((tramp-methods (cons '("method") tramp-methods))) | 2174 | (let ((tramp-methods (cons '("method") tramp-methods))) |
| 2090 | (should | 2175 | (should |
| @@ -2138,15 +2223,17 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2138 | ;; which ruins the tests. | 2223 | ;; which ruins the tests. |
| 2139 | (let ((non-essential n-e) | 2224 | (let ((non-essential n-e) |
| 2140 | (tramp-default-method | 2225 | (tramp-default-method |
| 2141 | (file-remote-p tramp-test-temporary-file-directory 'method))) | 2226 | (file-remote-p tramp-test-temporary-file-directory 'method)) |
| 2227 | (host (file-remote-p tramp-test-temporary-file-directory 'host))) | ||
| 2142 | (dolist | 2228 | (dolist |
| 2143 | (file | 2229 | (file |
| 2144 | `(,(format | 2230 | `(,(format "/%s::" tramp-default-method) |
| 2145 | "/%s::" | ||
| 2146 | (file-remote-p tramp-test-temporary-file-directory 'method)) | ||
| 2147 | ,(format | 2231 | ,(format |
| 2148 | "/-:%s:" | 2232 | "/-:%s:" |
| 2149 | (file-remote-p tramp-test-temporary-file-directory 'host)))) | 2233 | (if (string-match-p tramp-ipv6-regexp host) |
| 2234 | (concat | ||
| 2235 | tramp-prefix-ipv6-format host tramp-postfix-ipv6-format) | ||
| 2236 | host)))) | ||
| 2150 | (should (string-equal (directory-file-name file) file)) | 2237 | (should (string-equal (directory-file-name file) file)) |
| 2151 | (should | 2238 | (should |
| 2152 | (string-equal | 2239 | (string-equal |
| @@ -2301,7 +2388,8 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 2301 | (string-match | 2388 | (string-match |
| 2302 | (if (and (null noninteractive) | 2389 | (if (and (null noninteractive) |
| 2303 | (or (eq visit t) (null visit) (stringp visit))) | 2390 | (or (eq visit t) (null visit) (stringp visit))) |
| 2304 | (format "^Wrote %s\n\\'" tmp-name) "^\\'") | 2391 | (format "^Wrote %s\n\\'" (regexp-quote tmp-name)) |
| 2392 | "^\\'") | ||
| 2305 | tramp--test-messages)))))))) | 2393 | tramp--test-messages)))))))) |
| 2306 | 2394 | ||
| 2307 | ;; Do not overwrite if excluded. | 2395 | ;; Do not overwrite if excluded. |
| @@ -2889,6 +2977,8 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 2889 | 2977 | ||
| 2890 | (ert-deftest tramp-test17-dired-with-wildcards () | 2978 | (ert-deftest tramp-test17-dired-with-wildcards () |
| 2891 | "Check `dired' with wildcards." | 2979 | "Check `dired' with wildcards." |
| 2980 | ;; `separate' syntax and IPv6 host name syntax do not work. | ||
| 2981 | (skip-unless (not (string-match-p "\\[" tramp-test-temporary-file-directory))) | ||
| 2892 | (skip-unless (tramp--test-enabled)) | 2982 | (skip-unless (tramp--test-enabled)) |
| 2893 | (skip-unless (tramp--test-sh-p)) | 2983 | (skip-unless (tramp--test-sh-p)) |
| 2894 | (skip-unless (not (tramp--test-rsync-p))) | 2984 | (skip-unless (not (tramp--test-rsync-p))) |
| @@ -3461,18 +3551,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3461 | (should (file-equal-p tmp-name1 tmp-name2)) | 3551 | (should (file-equal-p tmp-name1 tmp-name2)) |
| 3462 | ;; Symbolic links could look like a remote file name. | 3552 | ;; Symbolic links could look like a remote file name. |
| 3463 | ;; They must be quoted then. | 3553 | ;; They must be quoted then. |
| 3464 | (delete-file tmp-name2) | 3554 | (let ((penguin |
| 3465 | (make-symbolic-link | 3555 | (if (eq tramp-syntax 'separate) |
| 3466 | (funcall | 3556 | "/[penguin/motd]" "/penguin:motd:"))) |
| 3467 | (if quoted #'tramp-compat-file-name-unquote #'identity) | 3557 | (delete-file tmp-name2) |
| 3468 | "/penguin:motd:") | 3558 | (make-symbolic-link |
| 3469 | tmp-name2) | 3559 | (funcall |
| 3470 | (should (file-symlink-p tmp-name2)) | 3560 | (if quoted #'tramp-compat-file-name-unquote #'identity) penguin) |
| 3471 | (should | 3561 | tmp-name2) |
| 3472 | (string-equal | 3562 | (should (file-symlink-p tmp-name2)) |
| 3473 | (file-truename tmp-name2) | 3563 | (should |
| 3474 | (tramp-compat-file-name-quote | 3564 | (string-equal |
| 3475 | (concat (file-remote-p tmp-name2) "/penguin:motd:")))) | 3565 | (file-truename tmp-name2) |
| 3566 | (tramp-compat-file-name-quote | ||
| 3567 | (concat (file-remote-p tmp-name2) penguin))))) | ||
| 3476 | ;; `tmp-name3' is a local file name. | 3568 | ;; `tmp-name3' is a local file name. |
| 3477 | ;; `make-symbolic-link' might not be permitted on w32 systems. | 3569 | ;; `make-symbolic-link' might not be permitted on w32 systems. |
| 3478 | (unless (tramp--test-windows-nt) | 3570 | (unless (tramp--test-windows-nt) |
| @@ -3880,7 +3972,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3880 | (if (zerop (length tramp-method-regexp)) | 3972 | (if (zerop (length tramp-method-regexp)) |
| 3881 | "" tramp-default-method-marker)) | 3973 | "" tramp-default-method-marker)) |
| 3882 | ;; This is needed for the `separate' syntax. | 3974 | ;; This is needed for the `separate' syntax. |
| 3883 | (prefix-format (substring tramp-prefix-format 1))) | 3975 | (prefix-format (substring tramp-prefix-format 1)) |
| 3976 | ;; This is needed for the IPv6 host name syntax. | ||
| 3977 | (ipv6-prefix | ||
| 3978 | (and (string-match-p tramp-ipv6-regexp host) | ||
| 3979 | tramp-prefix-ipv6-format)) | ||
| 3980 | (ipv6-postfix | ||
| 3981 | (and (string-match-p tramp-ipv6-regexp host) | ||
| 3982 | tramp-postfix-ipv6-format))) | ||
| 3884 | ;; Complete method name. | 3983 | ;; Complete method name. |
| 3885 | (unless (or (zerop (length method)) | 3984 | (unless (or (zerop (length method)) |
| 3886 | (zerop (length tramp-method-regexp))) | 3985 | (zerop (length tramp-method-regexp))) |
| @@ -3899,11 +3998,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3899 | (member | 3998 | (member |
| 3900 | (concat | 3999 | (concat |
| 3901 | prefix-format method-marker tramp-postfix-method-format | 4000 | prefix-format method-marker tramp-postfix-method-format |
| 3902 | host tramp-postfix-host-format) | 4001 | ipv6-prefix host ipv6-postfix tramp-postfix-host-format) |
| 3903 | (file-name-all-completions | 4002 | (file-name-all-completions |
| 3904 | (concat | 4003 | (concat |
| 3905 | prefix-format method-marker tramp-postfix-method-format | 4004 | prefix-format method-marker tramp-postfix-method-format |
| 3906 | (substring host 0 1)) | 4005 | ipv6-prefix (substring host 0 1)) |
| 3907 | "/"))))) | 4006 | "/"))))) |
| 3908 | ;; Complete host name. | 4007 | ;; Complete host name. |
| 3909 | (unless (or (zerop (length method)) | 4008 | (unless (or (zerop (length method)) |
| @@ -3914,7 +4013,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3914 | (member | 4013 | (member |
| 3915 | (concat | 4014 | (concat |
| 3916 | prefix-format method tramp-postfix-method-format | 4015 | prefix-format method tramp-postfix-method-format |
| 3917 | host tramp-postfix-host-format) | 4016 | ipv6-prefix host ipv6-postfix tramp-postfix-host-format) |
| 3918 | (file-name-all-completions | 4017 | (file-name-all-completions |
| 3919 | (concat prefix-format method tramp-postfix-method-format) | 4018 | (concat prefix-format method tramp-postfix-method-format) |
| 3920 | "/")))))) | 4019 | "/")))))) |
| @@ -4152,7 +4251,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4152 | (let ((default-directory tramp-test-temporary-file-directory) | 4251 | (let ((default-directory tramp-test-temporary-file-directory) |
| 4153 | (tmp-name (tramp--test-make-temp-name nil quoted)) | 4252 | (tmp-name (tramp--test-make-temp-name nil quoted)) |
| 4154 | kill-buffer-query-functions proc) | 4253 | kill-buffer-query-functions proc) |
| 4155 | (should-not (with-no-warnings (make-process))) | 4254 | (with-no-warnings (should-not (make-process))) |
| 4156 | 4255 | ||
| 4157 | ;; Simple process. | 4256 | ;; Simple process. |
| 4158 | (unwind-protect | 4257 | (unwind-protect |
| @@ -4522,8 +4621,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4522 | (skip-unless (tramp--test-enabled)) | 4621 | (skip-unless (tramp--test-enabled)) |
| 4523 | ;; We test it only for the mock-up connection; otherwise there might | 4622 | ;; We test it only for the mock-up connection; otherwise there might |
| 4524 | ;; be problems with the used ports. | 4623 | ;; be problems with the used ports. |
| 4525 | (skip-unless (and (eq tramp-syntax 'default) | 4624 | (skip-unless (and (eq tramp-syntax 'default) (tramp--test-mock-p))) |
| 4526 | (tramp--test-mock-p))) | ||
| 4527 | 4625 | ||
| 4528 | ;; We force a reconnect, in order to have a clean environment. | 4626 | ;; We force a reconnect, in order to have a clean environment. |
| 4529 | (dolist (dir `(,tramp-test-temporary-file-directory | 4627 | (dolist (dir `(,tramp-test-temporary-file-directory |
| @@ -4871,23 +4969,25 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 4871 | (unwind-protect | 4969 | (unwind-protect |
| 4872 | (progn | 4970 | (progn |
| 4873 | ;; Use default `auto-save-file-name-transforms' mechanism. | 4971 | ;; Use default `auto-save-file-name-transforms' mechanism. |
| 4874 | (let (tramp-auto-save-directory) | 4972 | ;; It isn't prepared for `separate' syntax. |
| 4875 | (with-temp-buffer | 4973 | (unless (eq tramp-syntax 'separate) |
| 4876 | (setq buffer-file-name tmp-name1) | 4974 | (let (tramp-auto-save-directory) |
| 4877 | (should | 4975 | (with-temp-buffer |
| 4878 | (string-equal | 4976 | (setq buffer-file-name tmp-name1) |
| 4879 | (make-auto-save-file-name) | 4977 | (should |
| 4880 | ;; This is taken from original `make-auto-save-file-name'. | 4978 | (string-equal |
| 4881 | ;; We call `convert-standard-filename', because on | 4979 | (make-auto-save-file-name) |
| 4882 | ;; MS Windows the (local) colons must be replaced by | 4980 | ;; This is taken from original `make-auto-save-file-name'. |
| 4883 | ;; exclamation marks. | 4981 | ;; We call `convert-standard-filename', because on |
| 4884 | (convert-standard-filename | 4982 | ;; MS Windows the (local) colons must be replaced by |
| 4885 | (expand-file-name | 4983 | ;; exclamation marks. |
| 4886 | (format | 4984 | (convert-standard-filename |
| 4887 | "#%s#" | 4985 | (expand-file-name |
| 4888 | (subst-char-in-string | 4986 | (format |
| 4889 | ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) | 4987 | "#%s#" |
| 4890 | temporary-file-directory)))))) | 4988 | (subst-char-in-string |
| 4989 | ?/ ?! (replace-regexp-in-string "!" "!!" tmp-name1))) | ||
| 4990 | temporary-file-directory))))))) | ||
| 4891 | 4991 | ||
| 4892 | ;; No mapping. | 4992 | ;; No mapping. |
| 4893 | (let (tramp-auto-save-directory auto-save-file-name-transforms) | 4993 | (let (tramp-auto-save-directory auto-save-file-name-transforms) |
| @@ -5897,6 +5997,9 @@ process sentinels. They shall not disturb each other." | |||
| 5897 | ;; This test is inspired by Bug#29163. | 5997 | ;; This test is inspired by Bug#29163. |
| 5898 | (ert-deftest tramp-test44-auto-load () | 5998 | (ert-deftest tramp-test44-auto-load () |
| 5899 | "Check that Tramp autoloads properly." | 5999 | "Check that Tramp autoloads properly." |
| 6000 | ;; If we use another syntax but `default', Tramp is already loaded | ||
| 6001 | ;; due to the `tramp-change-syntax' call. | ||
| 6002 | (skip-unless (eq tramp-syntax 'default)) | ||
| 5900 | (skip-unless (tramp--test-enabled)) | 6003 | (skip-unless (tramp--test-enabled)) |
| 5901 | 6004 | ||
| 5902 | (let ((default-directory (expand-file-name temporary-file-directory)) | 6005 | (let ((default-directory (expand-file-name temporary-file-directory)) |
| @@ -6041,8 +6144,8 @@ Since it unloads Tramp, it shall be the last test to run." | |||
| 6041 | (not (string-match "unload-hook$" (symbol-name x))) | 6144 | (not (string-match "unload-hook$" (symbol-name x))) |
| 6042 | (ert-fail (format "`%s' still bound" x))))) | 6145 | (ert-fail (format "`%s' still bound" x))))) |
| 6043 | ;; The defstruct `tramp-file-name' and all its internal functions | 6146 | ;; The defstruct `tramp-file-name' and all its internal functions |
| 6044 | ;; shall be purged. | 6147 | ;; shall be purged. `cl--find-class' must be protected in Emacs 24. |
| 6045 | (should-not (with-no-warnings (cl--find-class 'tramp-file-name))) | 6148 | (with-no-warnings (should-not (cl--find-class 'tramp-file-name))) |
| 6046 | (mapatoms | 6149 | (mapatoms |
| 6047 | (lambda (x) | 6150 | (lambda (x) |
| 6048 | (and (functionp x) | 6151 | (and (functionp x) |