summaryrefslogtreecommitdiff
path: root/test/lisp/dired-x-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/lisp/dired-x-tests.el')
-rw-r--r--test/lisp/dired-x-tests.el53
1 files changed, 24 insertions, 29 deletions
diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el
index e6228f065d0..7acaa3c1319 100644
--- a/test/lisp/dired-x-tests.el
+++ b/test/lisp/dired-x-tests.el
@@ -19,6 +19,7 @@
;;; Code:
(require 'ert)
+(require 'ert-x)
(require 'dired-x)
@@ -31,36 +32,30 @@
(append (copy-sequence dirs)
(delete "c" (copy-sequence files)))
#'string<))
- (dir (make-temp-file "Bug25942" 'dir))
(extension "c"))
- (unwind-protect
- (progn
- (dolist (d dirs)
- (make-directory (expand-file-name d dir)))
- (dolist (f files)
- (write-region nil nil (expand-file-name f dir)))
- (dired dir)
- (dired-mark-extension extension)
- (should (equal '("bar.c" "foo.c")
- (sort (dired-get-marked-files 'local) #'string<)))
- (dired-unmark-all-marks)
- (dired-mark-suffix extension)
- (should (equal all-but-c
- (sort (dired-get-marked-files 'local) #'string<))))
- (delete-directory dir 'recursive))))
-
-(ert-deftest dired-guess-default ()
- (let ((dired-guess-shell-alist-user nil)
- (dired-guess-shell-alist-default
- '(("\\.png\\'" "display")
- ("\\.gif\\'" "display" "xloadimage")
- ("\\.gif\\'" "feh")
- ("\\.jpe?g\\'" "xloadimage"))))
- (should (equal (dired-guess-default '("/tmp/foo.png")) "display"))
- (should (equal (dired-guess-default '("/tmp/foo.gif"))
- '("display" "xloadimage" "feh")))
- (should (equal (dired-guess-default '("/tmp/foo.png" "/tmp/foo.txt"))
- nil))))
+ (ert-with-temp-directory dir
+ (dolist (d dirs)
+ (make-directory (expand-file-name d dir)))
+ (dolist (f files)
+ (write-region nil nil (expand-file-name f dir)))
+ (dired dir)
+ (dired-mark-extension extension)
+ (should (equal '("bar.c" "foo.c")
+ (sort (dired-get-marked-files 'local) #'string<)))
+ (dired-unmark-all-marks)
+ (dired-mark-suffix extension)
+ (should (equal all-but-c
+ (sort (dired-get-marked-files 'local) #'string<))))))
+
+(ert-deftest dired-x--string-to-number ()
+ (should (= (dired-x--string-to-number "2.4K") 2457.6))
+ (should (= (dired-x--string-to-number "2400") 2400))
+ (should (= (dired-x--string-to-number "123.4M") 129394278.4))
+ (should (= (dired-x--string-to-number "123.40000M") 129394278.4))
+ (should (= (dired-x--string-to-number "4.134") 4134))
+ (should (= (dired-x--string-to-number "4,134") 4134))
+ (should (= (dired-x--string-to-number "4 134") 4134))
+ (should (= (dired-x--string-to-number "41,52,134") 4152134)))
(provide 'dired-x-tests)
;;; dired-x-tests.el ends here