diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/fileio-tests.el | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/test/src/fileio-tests.el b/test/src/fileio-tests.el index 8b76912f5e1..ba160681470 100644 --- a/test/src/fileio-tests.el +++ b/test/src/fileio-tests.el | |||
| @@ -111,7 +111,10 @@ Also check that an encoding error can appear in a symlink." | |||
| 111 | (ert-deftest fileio-tests--HOME-trailing-slash () | 111 | (ert-deftest fileio-tests--HOME-trailing-slash () |
| 112 | "Test that expand-file-name of \"~\" respects trailing slash." | 112 | "Test that expand-file-name of \"~\" respects trailing slash." |
| 113 | (let ((old-home (getenv "HOME"))) | 113 | (let ((old-home (getenv "HOME"))) |
| 114 | (dolist (home '("/a/b/c" "/a/b/c/")) | 114 | (dolist (home |
| 115 | (if (memq system-type '(windows-nt ms-dos)) | ||
| 116 | '("c:/a/b/c" "c:/a/b/c/") | ||
| 117 | '("/a/b/c" "/a/b/c/"))) | ||
| 115 | (setenv "HOME" home) | 118 | (setenv "HOME" home) |
| 116 | (should (equal (expand-file-name "~") (expand-file-name home)))) | 119 | (should (equal (expand-file-name "~") (expand-file-name home)))) |
| 117 | (setenv "HOME" old-home))) | 120 | (setenv "HOME" old-home))) |
| @@ -119,13 +122,26 @@ Also check that an encoding error can appear in a symlink." | |||
| 119 | (ert-deftest fileio-tests--expand-file-name-trailing-slash () | 122 | (ert-deftest fileio-tests--expand-file-name-trailing-slash () |
| 120 | (dolist (fooslashalias '("foo/" "foo//" "foo/." "foo//." "foo///././." | 123 | (dolist (fooslashalias '("foo/" "foo//" "foo/." "foo//." "foo///././." |
| 121 | "foo/a/..")) | 124 | "foo/a/..")) |
| 122 | (should (equal (expand-file-name fooslashalias "/") "/foo/")) | 125 | (if (memq system-type '(windows-nt ms-dos)) |
| 123 | (should (equal (expand-file-name (concat "/" fooslashalias)) "/foo/"))) | 126 | (progn |
| 124 | (should (equal (expand-file-name "." "/usr/spool/") "/usr/spool/")) | 127 | (should (equal (expand-file-name fooslashalias "c:/") "c:/foo/")) |
| 125 | (should (equal (expand-file-name "" "/usr/spool/") "/usr/spool/")) | 128 | (should (equal (expand-file-name (concat "c:/" fooslashalias)) |
| 129 | "c:/foo/")) | ||
| 130 | (should (equal (expand-file-name "." "c:/usr/spool/") | ||
| 131 | "c:/usr/spool/")) | ||
| 132 | (should (equal (expand-file-name "" "c:/usr/spool/") | ||
| 133 | "c:/usr/spool/"))) | ||
| 134 | (should (equal (expand-file-name fooslashalias "/") "/foo/")) | ||
| 135 | (should (equal (expand-file-name (concat "/" fooslashalias)) "/foo/")) | ||
| 136 | (should (equal (expand-file-name "." "/usr/spool/") "/usr/spool/")) | ||
| 137 | (should (equal (expand-file-name "" "/usr/spool/") "/usr/spool/")))) | ||
| 126 | ;; Trailing "B/C/.." means B must be a directory. | 138 | ;; Trailing "B/C/.." means B must be a directory. |
| 127 | (should (equal (expand-file-name "/a/b/c/..") "/a/b/")) | 139 | (if (memq system-type '(windows-nt ms-dos)) |
| 128 | (should (equal (expand-file-name "/a/b/c/../") "/a/b/"))) | 140 | (progn |
| 141 | (should (equal (expand-file-name "c:/a/b/c/..") "c:/a/b/")) | ||
| 142 | (should (equal (expand-file-name "c:/a/b/c/../") "c:/a/b/"))) | ||
| 143 | (should (equal (expand-file-name "/a/b/c/..") "/a/b/")) | ||
| 144 | (should (equal (expand-file-name "/a/b/c/../") "/a/b/")))) | ||
| 129 | 145 | ||
| 130 | (ert-deftest fileio-tests--insert-file-interrupt () | 146 | (ert-deftest fileio-tests--insert-file-interrupt () |
| 131 | (let ((text "-*- coding: binary -*-\n\xc3\xc3help") | 147 | (let ((text "-*- coding: binary -*-\n\xc3\xc3help") |