lisp/obsolete/*tls.el: Note when obsolescence was decided
[emacs.git] / test / lisp / dired-x-tests.el
blob9cdbcb4b803da36bfeebb37089c57050700c6211
1 ;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*-
3 ;; Copyright (C) 2017-2018 Free Software Foundation, Inc.
5 ;; This file is part of GNU Emacs.
7 ;; GNU Emacs is free software: you can redistribute it and/or modify
8 ;; it under the terms of the GNU General Public License as published by
9 ;; the Free Software Foundation, either version 3 of the License, or
10 ;; (at your option) any later version.
12 ;; GNU Emacs is distributed in the hope that it will be useful,
13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ;; GNU General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
20 ;;; Code:
21 (require 'ert)
22 (require 'dired-x)
25 (ert-deftest dired-test-bug25942 ()
26 "Test for https://debbugs.gnu.org/25942 ."
27 (let* ((dirs (list "Public" "Music"))
28 (files (list ".bashrc" "bar.c" "foo.c" "c" ".c"))
29 (all-but-c
30 (sort
31 (append (copy-sequence dirs)
32 (delete "c" (copy-sequence files)))
33 #'string<))
34 (dir (make-temp-file "Bug25942" 'dir))
35 (extension "c"))
36 (unwind-protect
37 (progn
38 (dolist (d dirs)
39 (make-directory (expand-file-name d dir)))
40 (dolist (f files)
41 (write-region nil nil (expand-file-name f dir)))
42 (dired dir)
43 (dired-mark-extension extension)
44 (should (equal '("bar.c" "foo.c")
45 (sort (dired-get-marked-files 'local) #'string<)))
46 (dired-unmark-all-marks)
47 (dired-mark-suffix extension)
48 (should (equal all-but-c
49 (sort (dired-get-marked-files 'local) #'string<))))
50 (delete-directory dir 'recursive))))
52 (provide 'dired-x-tests)
53 ;; dired-x-tests.el ends here