diff options
| author | Michael Albinus | 2020-11-02 17:56:06 +0100 |
|---|---|---|
| committer | Michael Albinus | 2020-11-02 17:56:06 +0100 |
| commit | e654b41c6f9eae424736bc8845d92b9dd97ccd3e (patch) | |
| tree | 53c7d09c4e5efd8f281888bc13527844a5933136 /test/src | |
| parent | 554495006e8d33a06c5df63fd8767c1124e1ed9e (diff) | |
| download | emacs-e654b41c6f9eae424736bc8845d92b9dd97ccd3e.tar.gz emacs-e654b41c6f9eae424736bc8845d92b9dd97ccd3e.zip | |
Fix some glitches in recent directory-files-* changes
* doc/lispref/files.texi (Contents of Directories):
Fix description of directory-files, directory-empty-p and
directory-files-and-attributes.
* etc/NEWS: Fix entry for directory-files-and-attributes. Fix typos.
* lisp/dired.el (directory-empty-p): Move function from here ...
* lisp/files.el (directory-empty-p): ... to here.
* lisp/net/ange-ftp.el (ange-ftp-directory-files): Call `nreverse' later.
* lisp/net/tramp.el (tramp-handle-directory-files):
* lisp/net/tramp-adb.el
(tramp-adb-handle-directory-files-and-attributes): Do not call
`nreverse'.
* src/dired.c (Fdirectory_files)
(Fdirectory_files_and_attributes): Fix docstrings.
* test/src/dired-tests.el: Removed. Tests moved to
test/lisp/dired-tests.el.
* test/lisp/dired-tests.el (dired-test-bug27899): Tag it :unstable.
(dired-test-directory-files)
(dired-test-directory-files-and-attributes): New tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/dired-tests.el | 105 |
1 files changed, 0 insertions, 105 deletions
diff --git a/test/src/dired-tests.el b/test/src/dired-tests.el deleted file mode 100644 index 3beb51366f7..00000000000 --- a/test/src/dired-tests.el +++ /dev/null | |||
| @@ -1,105 +0,0 @@ | |||
| 1 | ;;; dired-tests.el --- Tests for directory-files in dired.c -*- lexical-binding: t; -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2020 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; Author: Arthur Miller <arthur.miller@live.com> | ||
| 6 | ;; Keywords: | ||
| 7 | |||
| 8 | ;; This program is free software; you can redistribute it and/or modify | ||
| 9 | ;; it under the terms of the GNU General Public License as published by | ||
| 10 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 11 | ;; (at your option) any later version. | ||
| 12 | |||
| 13 | ;; This program is distributed in the hope that it will be useful, | ||
| 14 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 16 | ;; GNU General Public License for more details. | ||
| 17 | |||
| 18 | ;; You should have received a copy of the GNU General Public License | ||
| 19 | ;; along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
| 20 | |||
| 21 | ;;; Commentary: | ||
| 22 | |||
| 23 | ;; These tests check mostly for correct behaviour with COUNT argument. | ||
| 24 | |||
| 25 | ;;; Code: | ||
| 26 | (require 'ert) | ||
| 27 | |||
| 28 | (ert-deftest directory-files-tests () | ||
| 29 | (let ((testdir (expand-file-name "directory-files-test" | ||
| 30 | (temporary-file-directory))) | ||
| 31 | (nod directory-files-no-dot-files-regexp)) | ||
| 32 | (unwind-protect | ||
| 33 | (progn | ||
| 34 | (when (file-directory-p testdir) | ||
| 35 | (delete-directory testdir t)) | ||
| 36 | |||
| 37 | (make-directory testdir) | ||
| 38 | (when (file-directory-p testdir) | ||
| 39 | ;; directory-empty-p: test non-existent dir | ||
| 40 | (should-not (directory-empty-p "some-imaginary-dir")) | ||
| 41 | (should (= 2 (length (directory-files testdir)))) | ||
| 42 | ;; directory-empty-p: test empty dir | ||
| 43 | (should (directory-empty-p testdir)) | ||
| 44 | (should-not (directory-files testdir nil nod t 1)) | ||
| 45 | (dolist (file '(a b c d)) | ||
| 46 | (make-empty-file (expand-file-name (symbol-name file) testdir))) | ||
| 47 | (should (= 6 (length (directory-files testdir)))) | ||
| 48 | (should (equal "abcd" (mapconcat 'identity (directory-files | ||
| 49 | testdir nil nod) ""))) | ||
| 50 | (should (= 2 (length (directory-files testdir nil "[bc]")))) | ||
| 51 | (should (= 3 (length (directory-files testdir nil nod nil 3)))) | ||
| 52 | (dolist (file '(5 4 3 2 1)) | ||
| 53 | (make-empty-file (expand-file-name (number-to-string | ||
| 54 | file) testdir))) | ||
| 55 | ;;(should (= 0 (length (directory-files testdir nil "[0-9]" t -1)))) | ||
| 56 | (should (= 5 (length (directory-files testdir nil "[0-9]" t)))) | ||
| 57 | (should (= 5 (length (directory-files testdir nil "[0-9]" t 50)))) | ||
| 58 | (should-not (directory-empty-p testdir))) | ||
| 59 | |||
| 60 | (delete-directory testdir t))))) | ||
| 61 | |||
| 62 | (ert-deftest directory-files-and-attributes-tests () | ||
| 63 | (let ((testdir (expand-file-name "directory-files-test" | ||
| 64 | (temporary-file-directory))) | ||
| 65 | (nod directory-files-no-dot-files-regexp)) | ||
| 66 | |||
| 67 | (unwind-protect | ||
| 68 | (progn | ||
| 69 | (when (file-directory-p testdir) | ||
| 70 | (delete-directory testdir t)) | ||
| 71 | |||
| 72 | (make-directory testdir) | ||
| 73 | (when (file-directory-p testdir) | ||
| 74 | (should (= 2 (length (directory-files testdir)))) | ||
| 75 | (should-not (directory-files-and-attributes testdir t nod t 1)) | ||
| 76 | (dolist (file '(a b c d)) | ||
| 77 | (make-directory (expand-file-name (symbol-name file) testdir))) | ||
| 78 | (should (= 6 (length (directory-files-and-attributes testdir)))) | ||
| 79 | (dolist (dir (directory-files-and-attributes testdir t nod)) | ||
| 80 | (should (file-directory-p (car dir))) | ||
| 81 | (should-not (file-regular-p (car dir)))) | ||
| 82 | (should (= 2 (length | ||
| 83 | (directory-files-and-attributes testdir nil | ||
| 84 | "[bc]")))) | ||
| 85 | (should (= 3 (length | ||
| 86 | (directory-files-and-attributes testdir nil nod | ||
| 87 | nil nil 3)))) | ||
| 88 | (dolist (file '(5 4 3 2 1)) | ||
| 89 | (make-empty-file (expand-file-name (number-to-string file) | ||
| 90 | testdir))) | ||
| 91 | ;; (should (= 0 (length (directory-files-and-attributes testdir nil | ||
| 92 | ;; "[0-9]" t | ||
| 93 | ;; nil -1)))) | ||
| 94 | (should (= 5 (length | ||
| 95 | (directory-files-and-attributes testdir nil | ||
| 96 | "[0-9]" t)))) | ||
| 97 | (should (= 5 (length | ||
| 98 | (directory-files-and-attributes testdir nil | ||
| 99 | "[0-9]" t | ||
| 100 | nil 50)))))) | ||
| 101 | (when (file-directory-p testdir) | ||
| 102 | (delete-directory testdir t))))) | ||
| 103 | |||
| 104 | (provide 'dired-tests) | ||
| 105 | ;;; dired-tests.el ends here | ||