diff options
| author | Craig Jennings <c@cjennings.net> | 2025-10-12 11:47:26 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2025-10-12 11:47:26 -0500 |
| commit | 092304d9e0ccc37cc0ddaa9b136457e56a1cac20 (patch) | |
| tree | ea81999b8442246c978b364dd90e8c752af50db5 /tests/test-fs--mode-to-permissions.el | |
changing repositories
Diffstat (limited to 'tests/test-fs--mode-to-permissions.el')
| -rw-r--r-- | tests/test-fs--mode-to-permissions.el | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/test-fs--mode-to-permissions.el b/tests/test-fs--mode-to-permissions.el new file mode 100644 index 00000000..3d27ac08 --- /dev/null +++ b/tests/test-fs--mode-to-permissions.el @@ -0,0 +1,36 @@ +;;; test-tool-library-fs--mode-to-permissions.el --- ERT tests for cj/fs--mode-to-permissions -*- lexical-binding: t; -*- + +;; Author: gptel-tool-writer and cjennings +;; Keywords: tests, filesystem, tools + +;;; Commentary: +;; ERT tests for the cj/fs--mode-to-permissions function from tool-filesystem-library.el. +;; Place this file in ~/.emacs.d/tests/ and load it to run tests. + +;;; Code: + +(require 'ert) +(require 'tool-filesystem-library) + +(ert-deftest test-cj/fs--mode-to-permissions-normal-directory () + "Normal: directory permissions string." + (should (string-prefix-p "d" + (cj/fs--mode-to-permissions #o40755)))) + +(ert-deftest test-cj/fs--mode-to-permissions-normal-regular-file () + "Normal: regular file permissions string." + (should (string-prefix-p "-" + (cj/fs--mode-to-permissions #o100644)))) + +(ert-deftest test-cj/fs--mode-to-permissions-boundary-zero () + "Boundary: no permissions." + (should (string= "----------" + (cj/fs--mode-to-permissions 0)))) + +(ert-deftest test-cj/fs--mode-to-permissions-boundary-full () + "Boundary: full permissions string." + (should (string= "-rwxrwxrwx" + (cj/fs--mode-to-permissions #o777)))) + +(provide 'test-tool-library-fs--mode-to-permissions) +;;; test-tool-library-fs--mode-to-permissions.el ends here |
