diff options
| author | Michael Albinus | 2013-11-15 09:03:19 +0100 |
|---|---|---|
| committer | Michael Albinus | 2013-11-15 09:03:19 +0100 |
| commit | 3cd4192f84071777b36dab8a051cda5059eb4262 (patch) | |
| tree | fb9f37db1f94ac7a22c4f9293e4c8fb623bca616 | |
| parent | e675b3e45242e65a4cab9271566ad9141a81036f (diff) | |
| download | emacs-3cd4192f84071777b36dab8a051cda5059eb4262.tar.gz emacs-3cd4192f84071777b36dab8a051cda5059eb4262.zip | |
* automated/tramp-tests.el (tramp-test15-copy-directory)
(tramp-test16-directory-files, tramp-test17-insert-directory)
(tramp-test18-file-attributes)
(tramp-test19-directory-files-and-attributes)
(tramp-test20-file-modes, tramp-test21-file-links)
(tramp-test22-file-times, tramp-test23-visited-file-modtime)
(tramp-test24-file-name-completion, tramp-test25-load)
(tramp-test26-process-file, tramp-test27-start-file-process):
(tramp-test28-shell-command): Protect unwindforms with `ignore-errors'.
(tramp-test29-utf8): New test.
| -rw-r--r-- | test/ChangeLog | 18 | ||||
| -rw-r--r-- | test/automated/tramp-tests.el | 81 |
2 files changed, 72 insertions, 27 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 9f345d64a42..c1e75879200 100644 --- a/test/ChangeLog +++ b/test/ChangeLog | |||
| @@ -1,3 +1,17 @@ | |||
| 1 | 2013-11-15 Michael Albinus <michael.albinus@gmx.de> | ||
| 2 | |||
| 3 | * automated/tramp-tests.el (tramp-test15-copy-directory) | ||
| 4 | (tramp-test16-directory-files, tramp-test17-insert-directory) | ||
| 5 | (tramp-test18-file-attributes) | ||
| 6 | (tramp-test19-directory-files-and-attributes) | ||
| 7 | (tramp-test20-file-modes, tramp-test21-file-links) | ||
| 8 | (tramp-test22-file-times, tramp-test23-visited-file-modtime) | ||
| 9 | (tramp-test24-file-name-completion, tramp-test25-load) | ||
| 10 | (tramp-test26-process-file, tramp-test27-start-file-process): | ||
| 11 | (tramp-test28-shell-command): Protect unwindforms with | ||
| 12 | `ignore-errors'. | ||
| 13 | (tramp-test29-utf8): New test. | ||
| 14 | |||
| 1 | 2013-11-13 Michael Albinus <michael.albinus@gmx.de> | 15 | 2013-11-13 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 16 | ||
| 3 | * automated/file-notify-tests.el (file-notify-test02-events) | 17 | * automated/file-notify-tests.el (file-notify-test02-events) |
| @@ -5,8 +19,8 @@ | |||
| 5 | 19 | ||
| 6 | * automated/tramp-tests.el (tramp-test02-file-name-dissect) | 20 | * automated/tramp-tests.el (tramp-test02-file-name-dissect) |
| 7 | (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests. | 21 | (tramp-test03-file-name-defaults, tramp-test21-file-links): Add tests. |
| 8 | (tramp-test26-process-file, tramp-test28-shell-command): Ensure, | 22 | (tramp-test26-process-file, tramp-test28-shell-command): |
| 9 | that the directory is not empty when calling "ls". | 23 | Ensure, that the directory is not empty when calling "ls". |
| 10 | 24 | ||
| 11 | 2013-11-11 Michael Albinus <michael.albinus@gmx.de> | 25 | 2013-11-11 Michael Albinus <michael.albinus@gmx.de> |
| 12 | 26 | ||
diff --git a/test/automated/tramp-tests.el b/test/automated/tramp-tests.el index d9fb5d2a15d..35a4936594c 100644 --- a/test/automated/tramp-tests.el +++ b/test/automated/tramp-tests.el | |||
| @@ -710,8 +710,9 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 710 | (copy-directory tmp-name1 tmp-name2) | 710 | (copy-directory tmp-name1 tmp-name2) |
| 711 | (should (file-directory-p tmp-name3)) | 711 | (should (file-directory-p tmp-name3)) |
| 712 | (should (file-exists-p tmp-name6))) | 712 | (should (file-exists-p tmp-name6))) |
| 713 | (delete-directory tmp-name1 'recursive) | 713 | (ignore-errors |
| 714 | (delete-directory tmp-name2 'recursive)))) | 714 | (delete-directory tmp-name1 'recursive) |
| 715 | (delete-directory tmp-name2 'recursive))))) | ||
| 715 | 716 | ||
| 716 | (ert-deftest tramp-test16-directory-files () | 717 | (ert-deftest tramp-test16-directory-files () |
| 717 | "Check `directory-files'." | 718 | "Check `directory-files'." |
| @@ -738,7 +739,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 738 | (should (equal (directory-files | 739 | (should (equal (directory-files |
| 739 | tmp-name1 'full directory-files-no-dot-files-regexp) | 740 | tmp-name1 'full directory-files-no-dot-files-regexp) |
| 740 | `(,tmp-name2 ,tmp-name3)))) | 741 | `(,tmp-name2 ,tmp-name3)))) |
| 741 | (delete-directory tmp-name1 'recursive)))) | 742 | (ignore-errors (delete-directory tmp-name1 'recursive))))) |
| 742 | 743 | ||
| 743 | (ert-deftest tramp-test17-insert-directory () | 744 | (ert-deftest tramp-test17-insert-directory () |
| 744 | "Check `insert-directory'." | 745 | "Check `insert-directory'." |
| @@ -770,7 +771,7 @@ This tests also `file-directory-p' and `file-accessible-directory-p'." | |||
| 770 | (goto-char (point-min)) | 771 | (goto-char (point-min)) |
| 771 | (should | 772 | (should |
| 772 | (looking-at-p "total +[[:digit:]]+\n.+ \\.\n.+ \\.\\.\n.+ foo$")))) | 773 | (looking-at-p "total +[[:digit:]]+\n.+ \\.\n.+ \\.\\.\n.+ foo$")))) |
| 773 | (delete-directory tmp-name1 'recursive)))) | 774 | (ignore-errors (delete-directory tmp-name1 'recursive))))) |
| 774 | 775 | ||
| 775 | (ert-deftest tramp-test18-file-attributes () | 776 | (ert-deftest tramp-test18-file-attributes () |
| 776 | "Check `file-attributes'. | 777 | "Check `file-attributes'. |
| @@ -812,7 +813,7 @@ This tests also `file-readable-p' and `file-regular-p'." | |||
| 812 | (should-not (file-regular-p tmp-name)) | 813 | (should-not (file-regular-p tmp-name)) |
| 813 | (setq attr (file-attributes tmp-name)) | 814 | (setq attr (file-attributes tmp-name)) |
| 814 | (should (eq (car attr) t))) | 815 | (should (eq (car attr) t))) |
| 815 | (delete-directory tmp-name)))) | 816 | (ignore-errors (delete-directory tmp-name))))) |
| 816 | 817 | ||
| 817 | (ert-deftest tramp-test19-directory-files-and-attributes () | 818 | (ert-deftest tramp-test19-directory-files-and-attributes () |
| 818 | "Check `directory-files-and-attributes'." | 819 | "Check `directory-files-and-attributes'." |
| @@ -838,7 +839,7 @@ This tests also `file-readable-p' and `file-regular-p'." | |||
| 838 | (equal (file-attributes (car elt)) (cdr elt)))) | 839 | (equal (file-attributes (car elt)) (cdr elt)))) |
| 839 | (setq attr (directory-files-and-attributes tmp-name nil "^b")) | 840 | (setq attr (directory-files-and-attributes tmp-name nil "^b")) |
| 840 | (should (equal (mapcar 'car attr) '("bar" "boz")))) | 841 | (should (equal (mapcar 'car attr) '("bar" "boz")))) |
| 841 | (delete-directory tmp-name 'recursive)))) | 842 | (ignore-errors (delete-directory tmp-name 'recursive))))) |
| 842 | 843 | ||
| 843 | (ert-deftest tramp-test20-file-modes () | 844 | (ert-deftest tramp-test20-file-modes () |
| 844 | "Check `file-modes'. | 845 | "Check `file-modes'. |
| @@ -859,7 +860,7 @@ This tests also `file-executable-p', `file-writable-p' and `set-file-modes'." | |||
| 859 | ;; A file is always writable for user "root". | 860 | ;; A file is always writable for user "root". |
| 860 | (unless (string-equal (file-remote-p tmp-name 'user) "root") | 861 | (unless (string-equal (file-remote-p tmp-name 'user) "root") |
| 861 | (should-not (file-writable-p tmp-name)))) | 862 | (should-not (file-writable-p tmp-name)))) |
| 862 | (delete-file tmp-name)))) | 863 | (ignore-errors (delete-file tmp-name))))) |
| 863 | 864 | ||
| 864 | (ert-deftest tramp-test21-file-links () | 865 | (ert-deftest tramp-test21-file-links () |
| 865 | "Check `file-symlink-p'. | 866 | "Check `file-symlink-p'. |
| @@ -879,8 +880,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 879 | (should (file-symlink-p tmp-name2)) | 880 | (should (file-symlink-p tmp-name2)) |
| 880 | ;; `tmp-name3' is a local file name. | 881 | ;; `tmp-name3' is a local file name. |
| 881 | (should-error (make-symbolic-link tmp-name1 tmp-name3))) | 882 | (should-error (make-symbolic-link tmp-name1 tmp-name3))) |
| 882 | (delete-file tmp-name1) | 883 | (ignore-errors |
| 883 | (delete-file tmp-name2)) | 884 | (delete-file tmp-name1) |
| 885 | (delete-file tmp-name2))) | ||
| 884 | 886 | ||
| 885 | (unwind-protect | 887 | (unwind-protect |
| 886 | (progn | 888 | (progn |
| @@ -893,8 +895,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 893 | (should-not (file-symlink-p tmp-name2)) | 895 | (should-not (file-symlink-p tmp-name2)) |
| 894 | ;; `tmp-name3' is a local file name. | 896 | ;; `tmp-name3' is a local file name. |
| 895 | (should-error (add-name-to-file tmp-name1 tmp-name3))) | 897 | (should-error (add-name-to-file tmp-name1 tmp-name3))) |
| 896 | (delete-file tmp-name1) | 898 | (ignore-errors |
| 897 | (delete-file tmp-name2)) | 899 | (delete-file tmp-name1) |
| 900 | (delete-file tmp-name2))) | ||
| 898 | 901 | ||
| 899 | (unwind-protect | 902 | (unwind-protect |
| 900 | (progn | 903 | (progn |
| @@ -905,8 +908,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 905 | (should-not (string-equal tmp-name2 (file-truename tmp-name2))) | 908 | (should-not (string-equal tmp-name2 (file-truename tmp-name2))) |
| 906 | (should | 909 | (should |
| 907 | (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) | 910 | (string-equal (file-truename tmp-name1) (file-truename tmp-name2)))) |
| 908 | (delete-file tmp-name1) | 911 | (ignore-errors |
| 909 | (delete-file tmp-name2)))) | 912 | (delete-file tmp-name1) |
| 913 | (delete-file tmp-name2))))) | ||
| 910 | 914 | ||
| 911 | (ert-deftest tramp-test22-file-times () | 915 | (ert-deftest tramp-test22-file-times () |
| 912 | "Check `set-file-times' and `file-newer-than-file-p'." | 916 | "Check `set-file-times' and `file-newer-than-file-p'." |
| @@ -928,8 +932,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 928 | ;; `tmp-name3' does not exist. | 932 | ;; `tmp-name3' does not exist. |
| 929 | (should (file-newer-than-file-p tmp-name2 tmp-name3)) | 933 | (should (file-newer-than-file-p tmp-name2 tmp-name3)) |
| 930 | (should-not (file-newer-than-file-p tmp-name3 tmp-name1))) | 934 | (should-not (file-newer-than-file-p tmp-name3 tmp-name1))) |
| 931 | (delete-file tmp-name1) | 935 | (ignore-errors |
| 932 | (delete-file tmp-name2)))) | 936 | (delete-file tmp-name1) |
| 937 | (delete-file tmp-name2))))) | ||
| 933 | 938 | ||
| 934 | (ert-deftest tramp-test23-visited-file-modtime () | 939 | (ert-deftest tramp-test23-visited-file-modtime () |
| 935 | "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." | 940 | "Check `set-visited-file-modtime' and `verify-visited-file-modtime'." |
| @@ -945,7 +950,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 945 | (set-visited-file-modtime '(0 1)) | 950 | (set-visited-file-modtime '(0 1)) |
| 946 | (should (verify-visited-file-modtime)) | 951 | (should (verify-visited-file-modtime)) |
| 947 | (should (equal (visited-file-modtime) '(0 1 0 0))))) | 952 | (should (equal (visited-file-modtime) '(0 1 0 0))))) |
| 948 | (delete-file tmp-name)))) | 953 | (ignore-errors (delete-file tmp-name))))) |
| 949 | 954 | ||
| 950 | (ert-deftest tramp-test24-file-name-completion () | 955 | (ert-deftest tramp-test24-file-name-completion () |
| 951 | "Check `file-name-completion' and `file-name-all-completions'." | 956 | "Check `file-name-completion' and `file-name-all-completions'." |
| @@ -966,7 +971,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 966 | (should | 971 | (should |
| 967 | (equal (sort (file-name-all-completions "b" tmp-name) 'string-lessp) | 972 | (equal (sort (file-name-all-completions "b" tmp-name) 'string-lessp) |
| 968 | '("bold" "boz/")))) | 973 | '("bold" "boz/")))) |
| 969 | (delete-directory tmp-name 'recursive)))) | 974 | (ignore-errors (delete-directory tmp-name 'recursive))))) |
| 970 | 975 | ||
| 971 | (ert-deftest tramp-test25-load () | 976 | (ert-deftest tramp-test25-load () |
| 972 | "Check `load'." | 977 | "Check `load'." |
| @@ -981,8 +986,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 981 | ;(should-error (load tmp-name nil 'nomessage 'nosuffix 'must-suffix)) | 986 | ;(should-error (load tmp-name nil 'nomessage 'nosuffix 'must-suffix)) |
| 982 | (load tmp-name nil 'nomessage 'nosuffix) | 987 | (load tmp-name nil 'nomessage 'nosuffix) |
| 983 | (should (featurep 'tramp-test-load))) | 988 | (should (featurep 'tramp-test-load))) |
| 984 | (and (featurep 'tramp-test-load) (unload-feature 'tramp-test-load)) | 989 | (ignore-errors |
| 985 | (delete-file tmp-name)))) | 990 | (and (featurep 'tramp-test-load) (unload-feature 'tramp-test-load)) |
| 991 | (delete-file tmp-name))))) | ||
| 986 | 992 | ||
| 987 | (ert-deftest tramp-test26-process-file () | 993 | (ert-deftest tramp-test26-process-file () |
| 988 | "Check `process-file'." | 994 | "Check `process-file'." |
| @@ -1000,7 +1006,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1000 | (write-region "foo" nil tmp-name) | 1006 | (write-region "foo" nil tmp-name) |
| 1001 | (should (zerop (process-file "ls" nil t))) | 1007 | (should (zerop (process-file "ls" nil t))) |
| 1002 | (should (> (point-max) (point-min))))) | 1008 | (should (> (point-max) (point-min))))) |
| 1003 | (delete-file tmp-name)))) | 1009 | (ignore-errors (delete-file tmp-name))))) |
| 1004 | 1010 | ||
| 1005 | (ert-deftest tramp-test27-start-file-process () | 1011 | (ert-deftest tramp-test27-start-file-process () |
| 1006 | "Check `start-file-process'." | 1012 | "Check `start-file-process'." |
| @@ -1017,7 +1023,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1017 | (process-send-eof proc) | 1023 | (process-send-eof proc) |
| 1018 | (accept-process-output proc 1) | 1024 | (accept-process-output proc 1) |
| 1019 | (should (string-equal (buffer-string) "foo"))) | 1025 | (should (string-equal (buffer-string) "foo"))) |
| 1020 | (delete-process proc)) | 1026 | (ignore-errors (delete-process proc))) |
| 1021 | 1027 | ||
| 1022 | (unwind-protect | 1028 | (unwind-protect |
| 1023 | (with-temp-buffer | 1029 | (with-temp-buffer |
| @@ -1030,8 +1036,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1030 | (should (processp proc)) | 1036 | (should (processp proc)) |
| 1031 | (accept-process-output proc 1) | 1037 | (accept-process-output proc 1) |
| 1032 | (should (string-equal (buffer-string) "foo"))) | 1038 | (should (string-equal (buffer-string) "foo"))) |
| 1033 | (delete-process proc) | 1039 | (ignore-errors |
| 1034 | (delete-file tmp-name)) | 1040 | (delete-process proc) |
| 1041 | (delete-file tmp-name))) | ||
| 1035 | 1042 | ||
| 1036 | (unwind-protect | 1043 | (unwind-protect |
| 1037 | (progn | 1044 | (progn |
| @@ -1043,7 +1050,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1043 | (process-send-string proc "foo") | 1050 | (process-send-string proc "foo") |
| 1044 | (process-send-eof proc) | 1051 | (process-send-eof proc) |
| 1045 | (accept-process-output proc 1)) | 1052 | (accept-process-output proc 1)) |
| 1046 | (delete-process proc)))) | 1053 | (ignore-errors (delete-process proc))))) |
| 1047 | 1054 | ||
| 1048 | (ert-deftest tramp-test28-shell-command () | 1055 | (ert-deftest tramp-test28-shell-command () |
| 1049 | "Check `shell-command'." | 1056 | "Check `shell-command'." |
| @@ -1055,7 +1062,31 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 1055 | (write-region "foo" nil tmp-name) | 1062 | (write-region "foo" nil tmp-name) |
| 1056 | (shell-command "ls" (current-buffer)) | 1063 | (shell-command "ls" (current-buffer)) |
| 1057 | (should (> (point-max) (point-min)))) | 1064 | (should (> (point-max) (point-min)))) |
| 1058 | (delete-file tmp-name)))) | 1065 | (ignore-errors (delete-file tmp-name))))) |
| 1066 | |||
| 1067 | (ert-deftest tramp-test29-utf8 () | ||
| 1068 | "Check UTF8 encoding in file names and file contents." | ||
| 1069 | (skip-unless (tramp--test-enabled)) | ||
| 1070 | (let ((tmp-name (tramp--test-make-temp-name)) | ||
| 1071 | (arabic "أصبح بوسعك الآن تنزيل نسخة كاملة من موسوعة ويكيبيديا العربية لتصفحها بلا اتصال بالإنترنت.") | ||
| 1072 | (chinese "银河系漫游指南系列") | ||
| 1073 | (russian "Автостопом по гала́ктике")) | ||
| 1074 | (unwind-protect | ||
| 1075 | (progn | ||
| 1076 | (make-directory tmp-name) | ||
| 1077 | (dolist (lang `(,arabic ,chinese ,russian)) | ||
| 1078 | (let ((file (expand-file-name lang tmp-name))) | ||
| 1079 | (write-region lang nil file) | ||
| 1080 | (should (file-exists-p file)) | ||
| 1081 | ;; Check file contents. | ||
| 1082 | (with-temp-buffer | ||
| 1083 | (insert-file-contents file) | ||
| 1084 | (should (string-equal (buffer-string) lang))))) | ||
| 1085 | ;; Check file name. | ||
| 1086 | (should (equal (directory-files | ||
| 1087 | tmp-name nil directory-files-no-dot-files-regexp) | ||
| 1088 | (sort `(,arabic ,chinese ,russian) 'string-lessp)))) | ||
| 1089 | (ignore-errors (delete-directory tmp-name 'recursive))))) | ||
| 1059 | 1090 | ||
| 1060 | ;; TODO: | 1091 | ;; TODO: |
| 1061 | 1092 | ||