blob: 3d27ac08013069310f7994a2420a5b9e093e3117 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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
|