diff options
Diffstat (limited to 'tests/test-fs-format-file-info.el')
| -rw-r--r-- | tests/test-fs-format-file-info.el | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/test-fs-format-file-info.el b/tests/test-fs-format-file-info.el new file mode 100644 index 00000000..b5a82f4b --- /dev/null +++ b/tests/test-fs-format-file-info.el @@ -0,0 +1,40 @@ +;;; test-tool-library-fs-format-file-info.el --- ERT tests for cj/fs-format-file-info -*- lexical-binding: t; -*- + +;; Author: gptel-tool-writer and cjennings +;; Keywords: tests, filesystem, tools + +;;; Commentary: +;; ERT tests for the cj/fs-format-file-info function from tool-filesystem-library.el. +;; Place this file in ~/.emacs.d/tests/ and load it to run tests. + +;;; Code: + +(require 'ert) +(require 'f) +(require 'tool-filesystem-library) + +(ert-deftest test-cj/fs-format-file-info-normal-typical () + "Normal: format typical file info plist." + (let ((info (list :permissions "-rw-r--r--" + :executable nil + :size 1024 + :last-modified (current-time) + :path "~/test-file.txt"))) + (should (string-match-p "test-file.txt" (cj/fs-format-file-info info "~"))))) + +(ert-deftest test-cj/fs-format-file-info-error-missing-keys () + "Error: format with missing keys handled." + (let ((info (list))) + (should (cj/fs-format-file-info info "~")))) + +(ert-deftest test-cj/fs-format-file-info-boundary-zero-size () + "Boundary: format with zero size." + (let ((info (list :permissions "-rw-r--r--" + :executable nil + :size 0 + :last-modified (current-time) + :path "~/empty-file.txt"))) + (should (string-match-p "empty-file.txt" (cj/fs-format-file-info info "~"))))) + +(provide 'test-tool-library-fs-format-file-info) +;;; test-tool-library-fs-format-file-info.el ends here |
