emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat 0803473abf 2/8: Add trivial tests


From: ELPA Syncer
Subject: [elpa] externals/compat 0803473abf 2/8: Add trivial tests
Date: Wed, 4 Jan 2023 14:57:25 -0500 (EST)

branch: externals/compat
commit 0803473abf9482f5937711b06325df754238888e
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Add trivial tests
---
 compat-26.el    | 22 +++++++++++-----------
 compat-27.el    | 18 +++++++++---------
 compat-tests.el | 15 +++++++++++++++
 3 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/compat-26.el b/compat-26.el
index 1bfe33996c..8ad7055809 100644
--- a/compat-26.el
+++ b/compat-26.el
@@ -394,63 +394,63 @@ the variable `temporary-file-directory' is returned."
           default-directory
         temporary-file-directory))))
 
-(compat-defun file-attribute-type (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-type (attributes) ;; <OK>
   "The type field in ATTRIBUTES returned by `file-attributes'.
 The value is either t for directory, string (name linked to) for
 symbolic link, or nil."
   (nth 0 attributes))
 
-(compat-defun file-attribute-link-number (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-link-number (attributes) ;; <OK>
   "Return the number of links in ATTRIBUTES returned by `file-attributes'."
   (nth 1 attributes))
 
-(compat-defun file-attribute-user-id (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-user-id (attributes) ;; <OK>
   "The UID field in ATTRIBUTES returned by `file-attributes'.
 This is either a string or a number.  If a string value cannot be
 looked up, a numeric value, either an integer or a float, is
 returned."
   (nth 2 attributes))
 
-(compat-defun file-attribute-group-id (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-group-id (attributes) ;; <OK>
   "The GID field in ATTRIBUTES returned by `file-attributes'.
 This is either a string or a number.  If a string value cannot be
 looked up, a numeric value, either an integer or a float, is
 returned."
   (nth 3 attributes))
 
-(compat-defun file-attribute-access-time (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-access-time (attributes) ;; <OK>
   "The last access time in ATTRIBUTES returned by `file-attributes'.
 This a Lisp timestamp in the style of `current-time'."
   (nth 4 attributes))
 
-(compat-defun file-attribute-modification-time (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-modification-time (attributes) ;; <OK>
   "The modification time in ATTRIBUTES returned by `file-attributes'.
 This is the time of the last change to the file's contents, and
 is a Lisp timestamp in the style of `current-time'."
   (nth 5 attributes))
 
-(compat-defun file-attribute-status-change-time (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-status-change-time (attributes) ;; <OK>
   "The status modification time in ATTRIBUTES returned by `file-attributes'.
 This is the time of last change to the file's attributes: owner
 and group, access mode bits, etc., and is a Lisp timestamp in the
 style of `current-time'."
   (nth 6 attributes))
 
-(compat-defun file-attribute-size (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-size (attributes) ;; <OK>
   "The integer size (in bytes) in ATTRIBUTES returned by `file-attributes'."
   (nth 7 attributes))
 
-(compat-defun file-attribute-modes (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-modes (attributes) ;; <OK>
   "The file modes in ATTRIBUTES returned by `file-attributes'.
 This is a string of ten letters or dashes as in ls -l."
   (nth 8 attributes))
 
-(compat-defun file-attribute-inode-number (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-inode-number (attributes) ;; <OK>
   "The inode number in ATTRIBUTES returned by `file-attributes'.
 It is a nonnegative integer."
   (nth 10 attributes))
 
-(compat-defun file-attribute-device-number (attributes) ;; <UNTESTED>
+(compat-defun file-attribute-device-number (attributes) ;; <OK>
   "The file system device number in ATTRIBUTES returned by `file-attributes'.
 It is an integer."
   (nth 11 attributes))
diff --git a/compat-27.el b/compat-27.el
index 4ebc2c5be7..9d90dce150 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -487,48 +487,48 @@ Elements of ALIST that are not conses are ignored."
 
 ;;;; Defined in simple.el
 
-(compat-defun decoded-time-second (time) ;; <UNTESTED>
+(compat-defun decoded-time-second (time) ;; <OK>
   "The seconds in TIME, which is a value returned by `decode-time'.
 This is an integer between 0 and 60 (inclusive).  (60 is a leap
 second, which only some operating systems support.)"
   (nth 0 time))
 
-(compat-defun decoded-time-minute (time) ;; <UNTESTED>
+(compat-defun decoded-time-minute (time) ;; <OK>
   "The minutes in TIME, which is a value returned by `decode-time'.
 This is an integer between 0 and 59 (inclusive)."
   (nth 1 time))
 
-(compat-defun decoded-time-hour (time) ;; <UNTESTED>
+(compat-defun decoded-time-hour (time) ;; <OK>
   "The hours in TIME, which is a value returned by `decode-time'.
 This is an integer between 0 and 23 (inclusive)."
   (nth 2 time))
 
-(compat-defun decoded-time-day (time) ;; <UNTESTED>
+(compat-defun decoded-time-day (time) ;; <OK>
   "The day-of-the-month in TIME, which is a value returned by `decode-time'.
 This is an integer between 1 and 31 (inclusive)."
   (nth 3 time))
 
-(compat-defun decoded-time-month (time) ;; <UNTESTED>
+(compat-defun decoded-time-month (time) ;; <OK>
   "The month in TIME, which is a value returned by `decode-time'.
 This is an integer between 1 and 12 (inclusive).  January is 1."
   (nth 4 time))
 
-(compat-defun decoded-time-year (time) ;; <UNTESTED>
+(compat-defun decoded-time-year (time) ;; <OK>
   "The year in TIME, which is a value returned by `decode-time'.
 This is a four digit integer."
   (nth 5 time))
 
-(compat-defun decoded-time-weekday (time) ;; <UNTESTED>
+(compat-defun decoded-time-weekday (time) ;; <OK>
   "The day-of-the-week in TIME, which is a value returned by `decode-time'.
 This is a number between 0 and 6, and 0 is Sunday."
   (nth 6 time))
 
-(compat-defun decoded-time-dst (time) ;; <UNTESTED>
+(compat-defun decoded-time-dst (time) ;; <OK>
   "The daylight saving time in TIME, which is a value returned by 
`decode-time'.
 This is t if daylight saving time is in effect, and nil if not."
   (nth 7 time))
 
-(compat-defun decoded-time-zone (time) ;; <UNTESTED>
+(compat-defun decoded-time-zone (time) ;; <OK>
   "The time zone in TIME, which is a value returned by `decode-time'.
 This is an integer indicating the UTC offset in seconds, i.e.,
 the number of seconds east of Greenwich."
diff --git a/compat-tests.el b/compat-tests.el
index 63d81971ce..c4065fc521 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -726,6 +726,21 @@
   (should-equal (expand-file-name "bar/.#b") (make-lock-file-name "bar/b"))
   (should-equal (expand-file-name "bar/.#foo") (make-lock-file-name 
"bar/foo")))
 
+(ert-deftest file-attributes ()
+  (let ((attrs '(type link-number user-id group-id access-time 
modification-time
+                 status-change-time size modes unspecified inode-number 
device-number)))
+    (should-equal (file-attribute-type attrs) 'type)
+    (should-equal (file-attribute-link-number attrs) 'link-number)
+    (should-equal (file-attribute-user-id attrs) 'user-id)
+    (should-equal (file-attribute-group-id attrs) 'group-id)
+    (should-equal (file-attribute-access-time attrs) 'access-time)
+    (should-equal (file-attribute-modification-time attrs) 'modification-time)
+    (should-equal (file-attribute-status-change-time attrs) 
'status-change-time)
+    (should-equal (file-attribute-size attrs) 'size)
+    (should-equal (file-attribute-modes attrs) 'modes)
+    (should-equal (file-attribute-inode-number attrs) 'inode-number)
+    (should-equal (file-attribute-device-number attrs) 'device-number)))
+
 (ert-deftest file-size-human-readable ()
   (should-equal "1000" (compat-call file-size-human-readable 1000))
   (should-equal "1k" (compat-call file-size-human-readable 1024))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]