diff options
| author | Michael Albinus | 2013-11-13 16:36:12 +0100 |
|---|---|---|
| committer | Michael Albinus | 2013-11-13 16:36:12 +0100 |
| commit | 927fbd6b95ae7bafacd478f978648baed98f7c9d (patch) | |
| tree | 870ee7e722eaf29a71bcccf7fbe37cf89cb3b36c | |
| parent | 11151a064bb0b21eb6b06562c8e775c6b763e93c (diff) | |
| download | emacs-927fbd6b95ae7bafacd478f978648baed98f7c9d.tar.gz emacs-927fbd6b95ae7bafacd478f978648baed98f7c9d.zip | |
* automated/file-notify-tests.el (file-notify-test02-events)
(file-notify-test03-autorevert): Suppress messages in `write-region'.
* automated/tramp-tests.el (tramp-test02-file-name-dissect)
(tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests.
(tramp-test26-process-file, tramp-test28-shell-command): Ensure,
that the directory is not empty when calling "ls".
| -rw-r--r-- | test/ChangeLog | 10 | ||||
| -rw-r--r-- | test/automated/file-notify-tests.el | 12 | ||||
| -rw-r--r-- | test/automated/tramp-tests.el | 179 |
3 files changed, 128 insertions, 73 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index eb307a04102..9f345d64a42 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-11-13 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * automated/file-notify-tests.el (file-notify-test02-events) | ||
| 4 | (file-notify-test03-autorevert): Suppress messages in `write-region'. | ||
| 5 | |||
| 6 | * automated/tramp-tests.el (tramp-test02-file-name-dissect) | ||
| 7 | (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests. | ||
| 8 | (tramp-test26-process-file, tramp-test28-shell-command): Ensure, | ||
| 9 | that the directory is not empty when calling "ls". | ||
| 10 | |||
| 1 | 2013-11-11 Michael Albinus <michael.albinus@gmx.de> | 11 | 2013-11-11 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 12 | ||
| 3 | * automated/tramp-tests.el (tramp-test-temporary-file-directory): | 13 | * automated/tramp-tests.el (tramp-test-temporary-file-directory): |
diff --git a/test/automated/file-notify-tests.el b/test/automated/file-notify-tests.el index b0cd7ce95f6..e0852fb5705 100644 --- a/test/automated/file-notify-tests.el +++ b/test/automated/file-notify-tests.el | |||
| @@ -189,16 +189,19 @@ Save the result in `file-notify--test-results', for later analysis." | |||
| 189 | '(change) 'file-notify--test-event-handler)) | 189 | '(change) 'file-notify--test-event-handler)) |
| 190 | 190 | ||
| 191 | ;; Check creation and removal. | 191 | ;; Check creation and removal. |
| 192 | (write-region "any text" nil file-notify--test-tmpfile) | 192 | (write-region |
| 193 | "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 193 | (delete-file file-notify--test-tmpfile) | 194 | (delete-file file-notify--test-tmpfile) |
| 194 | 195 | ||
| 195 | ;; Check copy and rename. | 196 | ;; Check copy and rename. |
| 196 | (write-region "any text" nil file-notify--test-tmpfile) | 197 | (write-region |
| 198 | "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 197 | (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) | 199 | (copy-file file-notify--test-tmpfile file-notify--test-tmpfile1) |
| 198 | (delete-file file-notify--test-tmpfile) | 200 | (delete-file file-notify--test-tmpfile) |
| 199 | (delete-file file-notify--test-tmpfile1) | 201 | (delete-file file-notify--test-tmpfile1) |
| 200 | 202 | ||
| 201 | (write-region "any text" nil file-notify--test-tmpfile) | 203 | (write-region |
| 204 | "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 202 | (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) | 205 | (rename-file file-notify--test-tmpfile file-notify--test-tmpfile1) |
| 203 | (delete-file file-notify--test-tmpfile1)) | 206 | (delete-file file-notify--test-tmpfile1)) |
| 204 | 207 | ||
| @@ -234,7 +237,8 @@ This test is skipped in batch mode." | |||
| 234 | (progn | 237 | (progn |
| 235 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) | 238 | (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)) |
| 236 | 239 | ||
| 237 | (write-region "any text" nil file-notify--test-tmpfile) | 240 | (write-region |
| 241 | "any text" nil file-notify--test-tmpfile nil 'no-message) | ||
| 238 | (setq buf (find-file-noselect file-notify--test-tmpfile)) | 242 | (setq buf (find-file-noselect file-notify--test-tmpfile)) |
| 239 | (with-current-buffer buf | 243 | (with-current-buffer buf |
| 240 | (should (string-equal (buffer-string) "any text")) | 244 | (should (string-equal (buffer-string) "any text")) |
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index 8cdc355a7a1..d9fb5d2a15d 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -319,8 +319,26 @@ being the result.") | |||
| 319 | (should (string-equal | 319 | (should (string-equal |
| 320 | (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) | 320 | (file-remote-p "/method:user@1.2.3.4:" 'localname) "")) |
| 321 | 321 | ||
| 322 | ;; This does not work. Why? | 322 | ;; Expand `tramp-default-method', `tramp-default-user' and |
| 323 | ;(should (file-remote-p "/[]:")) | 323 | ;; `tramp-default-host'. |
| 324 | (should (string-equal | ||
| 325 | (file-remote-p "/[]:") | ||
| 326 | (format | ||
| 327 | "/%s:%s@%s:" "default-method" "default-user" "default-host"))) | ||
| 328 | (should (string-equal (file-remote-p "/[]:" 'method) "default-method")) | ||
| 329 | (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) | ||
| 330 | (should (string-equal (file-remote-p "/[]:" 'host) "default-host")) | ||
| 331 | (should (string-equal (file-remote-p "/[]:" 'localname) "")) | ||
| 332 | |||
| 333 | ;; Expand `tramp-default-method' and `tramp-default-user'. | ||
| 334 | (let ((tramp-default-host "::1")) | ||
| 335 | (should (string-equal | ||
| 336 | (file-remote-p "/[]:") | ||
| 337 | (format "/%s:%s@%s:" "default-method" "default-user" "[::1]"))) | ||
| 338 | (should (string-equal (file-remote-p "/[]:" 'method) "default-method")) | ||
| 339 | (should (string-equal (file-remote-p "/[]:" 'user) "default-user")) | ||
| 340 | (should (string-equal (file-remote-p "/[]:" 'host) "::1")) | ||
| 341 | (should (string-equal (file-remote-p "/[]:" 'localname) ""))) | ||
| 324 | 342 | ||
| 325 | ;; Expand `tramp-default-method' and `tramp-default-user'. | 343 | ;; Expand `tramp-default-method' and `tramp-default-user'. |
| 326 | (should (string-equal | 344 | (should (string-equal |
| @@ -436,19 +454,21 @@ being the result.") | |||
| 436 | (dolist (u '("ftp" "anonymous")) | 454 | (dolist (u '("ftp" "anonymous")) |
| 437 | (should (string-equal (file-remote-p (format "/%s@:" u) 'method) "ftp"))) | 455 | (should (string-equal (file-remote-p (format "/%s@:" u) 'method) "ftp"))) |
| 438 | ;; Default values in tramp-gvfs.el. | 456 | ;; Default values in tramp-gvfs.el. |
| 439 | ;(should (string-equal (file-remote-p "/synce::" 'user) nil)) | 457 | (when (and (load "tramp-gvfs" 'noerror 'nomessage) |
| 458 | (symbol-value 'tramp-gvfs-enabled)) | ||
| 459 | (should (string-equal (file-remote-p "/synce::" 'user) nil))) | ||
| 440 | ;; Default values in tramp-gw.el. | 460 | ;; Default values in tramp-gw.el. |
| 441 | (dolist (m '("tunnel" "socks")) | 461 | (dolist (m '("tunnel" "socks")) |
| 442 | (should (string-equal (file-remote-p (format "/%s::" m) 'user) | 462 | (should |
| 443 | (user-login-name)))) | 463 | (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) |
| 444 | ;; Default values in tramp-sh.el. | 464 | ;; Default values in tramp-sh.el. |
| 445 | (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) | 465 | (dolist (h `("127.0.0.1" "[::1]" "localhost" "localhost6" ,(system-name))) |
| 446 | (should (string-equal (file-remote-p (format "/root@%s:" h) 'method) "su"))) | 466 | (should (string-equal (file-remote-p (format "/root@%s:" h) 'method) "su"))) |
| 447 | (dolist (m '("su" "sudo" "ksu")) | 467 | (dolist (m '("su" "sudo" "ksu")) |
| 448 | (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))) | 468 | (should (string-equal (file-remote-p (format "/%s::" m) 'user) "root"))) |
| 449 | (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp")) | 469 | (dolist (m '("rcp" "remcp" "rsh" "telnet" "krlogin" "fcp")) |
| 450 | (should (string-equal (file-remote-p (format "/%s::" m) 'user) | 470 | (should |
| 451 | (user-login-name)))) | 471 | (string-equal (file-remote-p (format "/%s::" m) 'user) (user-login-name)))) |
| 452 | ;; Default values in tramp-smb.el. | 472 | ;; Default values in tramp-smb.el. |
| 453 | (should (string-equal (file-remote-p "/user%domain@host:" 'method) "smb")) | 473 | (should (string-equal (file-remote-p "/user%domain@host:" 'method) "smb")) |
| 454 | (should (string-equal (file-remote-p "/smb::" 'user) nil))) | 474 | (should (string-equal (file-remote-p "/smb::" 'user) nil))) |
| @@ -456,65 +476,75 @@ being the result.") | |||
| 456 | (ert-deftest tramp-test04-substitute-in-file-name () | 476 | (ert-deftest tramp-test04-substitute-in-file-name () |
| 457 | "Check `substitute-in-file-name'." | 477 | "Check `substitute-in-file-name'." |
| 458 | (should (string-equal (substitute-in-file-name "/method:host://foo") "/foo")) | 478 | (should (string-equal (substitute-in-file-name "/method:host://foo") "/foo")) |
| 459 | (should (string-equal | 479 | (should |
| 460 | (substitute-in-file-name "/method:host:/path//foo") | 480 | (string-equal |
| 461 | "/method:host:/foo")) | 481 | (substitute-in-file-name "/method:host:/path//foo") "/method:host:/foo")) |
| 462 | (should (string-equal | 482 | (should |
| 463 | (substitute-in-file-name "/method:host:/path///foo") "/foo")) | 483 | (string-equal (substitute-in-file-name "/method:host:/path///foo") "/foo")) |
| 464 | (should (string-equal | 484 | (should |
| 465 | (substitute-in-file-name "/method:host:/path/~/foo") | 485 | (string-equal |
| 466 | "/method:host:~/foo")) | 486 | (substitute-in-file-name "/method:host:/path/~/foo") "/method:host:~/foo")) |
| 467 | (should (string-equal | 487 | (should |
| 468 | (substitute-in-file-name "/method:host:/path//~/foo") "~/foo")) | 488 | (string-equal (substitute-in-file-name "/method:host:/path//~/foo") "~/foo")) |
| 469 | (let (process-environment) | 489 | (let (process-environment) |
| 470 | (should | 490 | (should |
| 471 | (string-equal (substitute-in-file-name "/method:host:/path/$FOO") | 491 | (string-equal |
| 472 | "/method:host:/path/$FOO")) | 492 | (substitute-in-file-name "/method:host:/path/$FOO") |
| 493 | "/method:host:/path/$FOO")) | ||
| 473 | (setenv "FOO" "bla") | 494 | (setenv "FOO" "bla") |
| 474 | (should (string-equal | 495 | (should |
| 475 | (substitute-in-file-name "/method:host:/path/$FOO") | 496 | (string-equal |
| 476 | "/method:host:/path/bla")) | 497 | (substitute-in-file-name "/method:host:/path/$FOO") |
| 477 | (should (string-equal | 498 | "/method:host:/path/bla")) |
| 478 | (substitute-in-file-name "/method:host:/path/$$FOO") | 499 | (should |
| 479 | "/method:host:/path/$FOO")))) | 500 | (string-equal |
| 501 | (substitute-in-file-name "/method:host:/path/$$FOO") | ||
| 502 | "/method:host:/path/$FOO")))) | ||
| 480 | 503 | ||
| 481 | (ert-deftest tramp-test05-expand-file-name () | 504 | (ert-deftest tramp-test05-expand-file-name () |
| 482 | "Check `expand-file-name'." | 505 | "Check `expand-file-name'." |
| 483 | (should (string-equal | 506 | (should |
| 484 | (expand-file-name "/method:host:/path/./file") | 507 | (string-equal |
| 485 | "/method:host:/path/file")) | 508 | (expand-file-name "/method:host:/path/./file") "/method:host:/path/file")) |
| 486 | (should (string-equal | 509 | (should |
| 487 | (expand-file-name "/method:host:/path/../file") | 510 | (string-equal |
| 488 | "/method:host:/file"))) | 511 | (expand-file-name "/method:host:/path/../file") "/method:host:/file"))) |
| 489 | 512 | ||
| 490 | (ert-deftest tramp-test06-directory-file-name () | 513 | (ert-deftest tramp-test06-directory-file-name () |
| 491 | "Check `directory-file-name'. | 514 | "Check `directory-file-name'. |
| 492 | This checks also `file-name-as-directory', `file-name-directory' | 515 | This checks also `file-name-as-directory', `file-name-directory' |
| 493 | and `file-name-nondirectory'." | 516 | and `file-name-nondirectory'." |
| 494 | (should (string-equal | 517 | (should |
| 495 | (directory-file-name "/method:host:/path/to/file") | 518 | (string-equal |
| 496 | "/method:host:/path/to/file")) | 519 | (directory-file-name "/method:host:/path/to/file") |
| 497 | (should (string-equal | 520 | "/method:host:/path/to/file")) |
| 498 | (directory-file-name "/method:host:/path/to/file/") | 521 | (should |
| 499 | "/method:host:/path/to/file")) | 522 | (string-equal |
| 500 | (should (string-equal | 523 | (directory-file-name "/method:host:/path/to/file/") |
| 501 | (file-name-as-directory "/method:host:/path/to/file") | 524 | "/method:host:/path/to/file")) |
| 502 | "/method:host:/path/to/file/")) | 525 | (should |
| 503 | (should (string-equal | 526 | (string-equal |
| 504 | (file-name-as-directory "/method:host:/path/to/file/") | 527 | (file-name-as-directory "/method:host:/path/to/file") |
| 505 | "/method:host:/path/to/file/")) | 528 | "/method:host:/path/to/file/")) |
| 506 | (should (string-equal | 529 | (should |
| 507 | (file-name-directory "/method:host:/path/to/file") | 530 | (string-equal |
| 508 | "/method:host:/path/to/")) | 531 | (file-name-as-directory "/method:host:/path/to/file/") |
| 509 | (should (string-equal | 532 | "/method:host:/path/to/file/")) |
| 510 | (file-name-directory "/method:host:/path/to/file/") | 533 | (should |
| 511 | "/method:host:/path/to/file/")) | 534 | (string-equal |
| 512 | (should (string-equal | 535 | (file-name-directory "/method:host:/path/to/file") |
| 513 | (file-name-nondirectory "/method:host:/path/to/file") "file")) | 536 | "/method:host:/path/to/")) |
| 514 | (should (string-equal | 537 | (should |
| 515 | (file-name-nondirectory "/method:host:/path/to/file/") "")) | 538 | (string-equal |
| 516 | (should-not (file-remote-p | 539 | (file-name-directory "/method:host:/path/to/file/") |
| 517 | (unhandled-file-name-directory "/method:host:/path/to/file")))) | 540 | "/method:host:/path/to/file/")) |
| 541 | (should | ||
| 542 | (string-equal (file-name-nondirectory "/method:host:/path/to/file") "file")) | ||
| 543 | (should | ||
| 544 | (string-equal (file-name-nondirectory "/method:host:/path/to/file/") "")) | ||
| 545 | (should-not | ||
| 546 | (file-remote-p | ||
| 547 | (unhandled-file-name-directory "/method:host:/path/to/file")))) | ||
| 518 | 548 | ||
| 519 | (ert-deftest tramp-test07-file-exists-p () | 549 | (ert-deftest tramp-test07-file-exists-p () |
| 520 | "Check `file-exist-p', `write-region' and `delete-file'." | 550 | "Check `file-exist-p', `write-region' and `delete-file'." |
| @@ -872,7 +902,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 872 | (should (file-exists-p tmp-name1)) | 902 | (should (file-exists-p tmp-name1)) |
| 873 | (make-symbolic-link tmp-name1 tmp-name2) | 903 | (make-symbolic-link tmp-name1 tmp-name2) |
| 874 | (should (file-symlink-p tmp-name2)) | 904 | (should (file-symlink-p tmp-name2)) |
| 875 | (should (string-equal (file-truename tmp-name2) tmp-name1))) | 905 | (should-not (string-equal tmp-name2 (file-truename tmp-name2))) |
| 906 | (should | ||
| 907 | (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) | ||
| 876 | (delete-file tmp-name1) | 908 | (delete-file tmp-name1) |
| 877 | (delete-file tmp-name2)))) | 909 | (delete-file tmp-name2)))) |
| 878 | 910 | ||
| @@ -955,15 +987,20 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 955 | (ert-deftest tramp-test26-process-file () | 987 | (ert-deftest tramp-test26-process-file () |
| 956 | "Check `process-file'." | 988 | "Check `process-file'." |
| 957 | (skip-unless (tramp--test-enabled)) | 989 | (skip-unless (tramp--test-enabled)) |
| 958 | (let ((default-directory tramp-test-temporary-file-directory)) | 990 | (let ((tmp-name (tramp--test-make-temp-name)) |
| 959 | ;; We cannot use "/bin/true" and "/bin/false"; those paths do not | 991 | (default-directory tramp-test-temporary-file-directory)) |
| 960 | ;; exist on hydra. | 992 | (unwind-protect |
| 961 | (should (zerop (process-file "true"))) | 993 | (progn |
| 962 | (should-not (zerop (process-file "false"))) | 994 | ;; We cannot use "/bin/true" and "/bin/false"; those paths |
| 963 | (should-not (zerop (process-file "binary-does-not-exist"))) | 995 | ;; do not exist on hydra. |
| 964 | (with-temp-buffer | 996 | (should (zerop (process-file "true"))) |
| 965 | (should (zerop (process-file "ls" nil t))) | 997 | (should-not (zerop (process-file "false"))) |
| 966 | (should (> (point-max) (point-min)))))) | 998 | (should-not (zerop (process-file "binary-does-not-exist"))) |
| 999 | (with-temp-buffer | ||
| 1000 | (write-region "foo" nil tmp-name) | ||
| 1001 | (should (zerop (process-file "ls" nil t))) | ||
| 1002 | (should (> (point-max) (point-min))))) | ||
| 1003 | (delete-file tmp-name)))) | ||
| 967 | 1004 | ||
| 968 | (ert-deftest tramp-test27-start-file-process () | 1005 | (ert-deftest tramp-test27-start-file-process () |
| 969 | "Check `start-file-process'." | 1006 | "Check `start-file-process'." |
| @@ -1011,10 +1048,14 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1011 | (ert-deftest tramp-test28-shell-command () | 1048 | (ert-deftest tramp-test28-shell-command () |
| 1012 | "Check `shell-command'." | 1049 | "Check `shell-command'." |
| 1013 | (skip-unless (tramp--test-enabled)) | 1050 | (skip-unless (tramp--test-enabled)) |
| 1014 | (let ((default-directory tramp-test-temporary-file-directory)) | 1051 | (let ((tmp-name (tramp--test-make-temp-name)) |
| 1015 | (with-temp-buffer | 1052 | (default-directory tramp-test-temporary-file-directory)) |
| 1016 | (shell-command "ls" (current-buffer)) | 1053 | (unwind-protect |
| 1017 | (should (> (point-max) (point-min)))))) | 1054 | (with-temp-buffer |
| 1055 | (write-region "foo" nil tmp-name) | ||
| 1056 | (shell-command "ls" (current-buffer)) | ||
| 1057 | (should (> (point-max) (point-min)))) | ||
| 1058 | (delete-file tmp-name)))) | ||
| 1018 | 1059 | ||
| 1019 | ;; TODO: | 1060 | ;; TODO: |
| 1020 | 1061 | ||