diff options
| author | Tino Calancha | 2020-05-08 22:14:03 +0200 |
|---|---|---|
| committer | Tino Calancha | 2020-05-14 18:43:15 +0200 |
| commit | 3a284e578625e617fdc6085ae11da2b4e41bb59b (patch) | |
| tree | ff6c8708cc3cd9d892d2433be5adbf9156584157 /test | |
| parent | 4af8b17149ee04655f038229c6103963f247ff87 (diff) | |
| download | emacs-3a284e578625e617fdc6085ae11da2b4e41bb59b.tar.gz emacs-3a284e578625e617fdc6085ae11da2b4e41bb59b.zip | |
Combine archive-int-to-mode and tar-grind-file-modebug27952_combine-tar-grind-file-mode_archive-int-to-mode
Add a new function, file-modes-number-to-symbolic.
Make archive-int-to-mode and obsolete alias of it; use it
to define tar-grind-file-mode (Bug#27952).
* lisp/files.el (file-modes-number-to-symbolic): New defun.
* lisp/arc-mode.el (archive-int-to-mode): Make it an obsolete alias.
* lisp/tar-mode.el (tar-grind-file-mode):
Use file-modes-number-to-symbolic.
* test/lisp/arc-mode-tests.el (arc-mode-test-archive-int-to-mode)
* test/lisp/tar-mode-tests.el (tar-mode-test-tar-grind-file-mode):
Update test.
* test/lisp/files-tests.el (files-tests-file-modes-symbolic-to-number)
(files-tests-file-modes-number-to-symbolic): New tests.
* doc/lispref/files.texi (Changing Files): Document the new funtion.
* etc/NEWS (Lisp Changes in Emacs 28.1): Announce it.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/arc-mode-tests.el | 2 | ||||
| -rw-r--r-- | test/lisp/files-tests.el | 36 | ||||
| -rw-r--r-- | test/lisp/tar-mode-tests.el | 3 |
3 files changed, 39 insertions, 2 deletions
diff --git a/test/lisp/arc-mode-tests.el b/test/lisp/arc-mode-tests.el index df658b98139..22ca7e2ec55 100644 --- a/test/lisp/arc-mode-tests.el +++ b/test/lisp/arc-mode-tests.el | |||
| @@ -28,7 +28,7 @@ | |||
| 28 | (let ((alist (list (cons 448 "-rwx------") | 28 | (let ((alist (list (cons 448 "-rwx------") |
| 29 | (cons 420 "-rw-r--r--") | 29 | (cons 420 "-rw-r--r--") |
| 30 | (cons 292 "-r--r--r--") | 30 | (cons 292 "-r--r--r--") |
| 31 | (cons 512 "----------") | 31 | (cons 512 "---------T") |
| 32 | (cons 1024 "------S---") ; Bug#28092 | 32 | (cons 1024 "------S---") ; Bug#28092 |
| 33 | (cons 2048 "---S------")))) | 33 | (cons 2048 "---S------")))) |
| 34 | (dolist (x alist) | 34 | (dolist (x alist) |
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 05d9ceebf1d..4b902fd82ae 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -1164,6 +1164,42 @@ works as expected if the default directory is quoted." | |||
| 1164 | (should-not (make-directory a/b t)) | 1164 | (should-not (make-directory a/b t)) |
| 1165 | (delete-directory dir 'recursive))) | 1165 | (delete-directory dir 'recursive))) |
| 1166 | 1166 | ||
| 1167 | (ert-deftest files-tests-file-modes-symbolic-to-number () | ||
| 1168 | (let ((alist (list (cons "a=rwx" #o777) | ||
| 1169 | (cons "o=t" #o1000) | ||
| 1170 | (cons "o=xt" #o1001) | ||
| 1171 | (cons "o=tx" #o1001) ; Order doesn't matter. | ||
| 1172 | (cons "u=rwx,g=rx,o=rx" #o755) | ||
| 1173 | (cons "u=rwx,g=,o=" #o700) | ||
| 1174 | (cons "u=rwx" #o700) ; Empty permissions can be ignored. | ||
| 1175 | (cons "u=rw,g=r,o=r" #o644) | ||
| 1176 | (cons "u=rw,g=r,o=t" #o1640) | ||
| 1177 | (cons "u=rw,g=r,o=xt" #o1641) | ||
| 1178 | (cons "u=rwxs,g=rs,o=xt" #o7741) | ||
| 1179 | (cons "u=rws,g=rs,o=t" #o7640) | ||
| 1180 | (cons "u=rws,g=rs,o=r" #o6644) | ||
| 1181 | (cons "a=r" #o444) | ||
| 1182 | (cons "u=S" nil) | ||
| 1183 | (cons "u=T" nil) | ||
| 1184 | (cons "u=Z" nil)))) | ||
| 1185 | (dolist (x alist) | ||
| 1186 | (if (cdr-safe x) | ||
| 1187 | (should (equal (cdr x) (file-modes-symbolic-to-number (car x)))) | ||
| 1188 | (should-error (file-modes-symbolic-to-number (car x))))))) | ||
| 1189 | |||
| 1190 | (ert-deftest files-tests-file-modes-number-to-symbolic () | ||
| 1191 | (let ((alist (list (cons #o755 "-rwxr-xr-x") | ||
| 1192 | (cons #o700 "-rwx------") | ||
| 1193 | (cons #o644 "-rw-r--r--") | ||
| 1194 | (cons #o1640 "-rw-r----T") | ||
| 1195 | (cons #o1641 "-rw-r----t") | ||
| 1196 | (cons #o7741 "-rwsr-S--t") | ||
| 1197 | (cons #o7640 "-rwSr-S--T") | ||
| 1198 | (cons #o6644 "-rwSr-Sr--") | ||
| 1199 | (cons #o444 "-r--r--r--")))) | ||
| 1200 | (dolist (x alist) | ||
| 1201 | (should (equal (cdr x) (file-modes-number-to-symbolic (car x))))))) | ||
| 1202 | |||
| 1167 | (ert-deftest files-tests-no-file-write-contents () | 1203 | (ert-deftest files-tests-no-file-write-contents () |
| 1168 | "Test that `write-contents-functions' permits saving a file. | 1204 | "Test that `write-contents-functions' permits saving a file. |
| 1169 | Usually `basic-save-buffer' will prompt for a file name if the | 1205 | Usually `basic-save-buffer' will prompt for a file name if the |
diff --git a/test/lisp/tar-mode-tests.el b/test/lisp/tar-mode-tests.el index bc41b863da7..f05389df60f 100644 --- a/test/lisp/tar-mode-tests.el +++ b/test/lisp/tar-mode-tests.el | |||
| @@ -29,7 +29,8 @@ | |||
| 29 | (cons 420 "rw-r--r--") | 29 | (cons 420 "rw-r--r--") |
| 30 | (cons 292 "r--r--r--") | 30 | (cons 292 "r--r--r--") |
| 31 | (cons 512 "--------T") | 31 | (cons 512 "--------T") |
| 32 | (cons 1024 "-----S---")))) | 32 | (cons 1024 "-----S---") |
| 33 | (cons 2048 "--S------")))) | ||
| 33 | (dolist (x alist) | 34 | (dolist (x alist) |
| 34 | (should (equal (cdr x) (tar-grind-file-mode (car x))))))) | 35 | (should (equal (cdr x) (tar-grind-file-mode (car x))))))) |
| 35 | 36 | ||