summaryrefslogtreecommitdiff
path: root/dired-rmjunk.el
diff options
context:
space:
mode:
authorJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-05-25 14:29:51 -0400
committerJakob L. Kreuze <zerodaysfordays@sdf.lonestar.org>2019-05-25 14:29:51 -0400
commitc70f4643e1efc2ee395c424bfa8a62764ed58b95 (patch)
tree9bd8eaec1e858cf2da1b2af807e280a9e36a246d /dired-rmjunk.el
parent0ef0ccaa908a1c2baa04905727ec12a5caef4a25 (diff)
Add tests for --dir-name and --file-name
Diffstat (limited to 'dired-rmjunk.el')
-rw-r--r--dired-rmjunk.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/dired-rmjunk.el b/dired-rmjunk.el
index 876af98..199b6fd 100644
--- a/dired-rmjunk.el
+++ b/dired-rmjunk.el
@@ -77,6 +77,14 @@ does not contain a directory component."
(if split-offset
(cl-subseq path 0 (1+ split-offset)))))
+(ert-deftest dired-rmjunk-test-dir-name ()
+ (should (equal (dired-rmjunk--dir-name ".FRD/links.txt")
+ ".FRD/"))
+ (should (equal (dired-rmjunk--dir-name ".local/share/recently-used.xbel")
+ ".local/share/"))
+ (should (equal (dired-rmjunk--dir-name ".asy")
+ nil)))
+
(defun dired-rmjunk--file-name (path)
"Return the file-name portion of PATH."
(let ((split-offset (cl-position ?\/ path :from-end t)))
@@ -85,5 +93,13 @@ does not contain a directory component."
;; If there's no directory component, `path' IS the file-name!
path)))
+(ert-deftest dired-rmjunk-test-file-name ()
+ (should (equal (dired-rmjunk--file-name ".FRD/links.txt")
+ "links.txt"))
+ (should (equal (dired-rmjunk--file-name ".local/share/recently-used.xbel")
+ "recently-used.xbel"))
+ (should (equal (dired-rmjunk--file-name ".asy")
+ ".asy")))
+
(provide 'dired-rmjunk)
;;; dired-rmjunk.el ends here