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

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

[elpa] externals/compat 74673d33fa 05/12: Add tests


From: ELPA Syncer
Subject: [elpa] externals/compat 74673d33fa 05/12: Add tests
Date: Wed, 4 Jan 2023 12:57:36 -0500 (EST)

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

    Add tests
---
 compat-25.el    |  2 +-
 compat-27.el    |  8 ++++----
 compat-28.el    |  2 +-
 compat-tests.el | 14 ++++++++++++--
 4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/compat-25.el b/compat-25.el
index f24bd93541..9ad856f39d 100644
--- a/compat-25.el
+++ b/compat-25.el
@@ -58,7 +58,7 @@ usage: (bool-vector &rest OBJECTS)"
 
 ;;;; Defined in editfns.c
 
-(compat-defun format-message (string &rest objects) ;; <UNTESTED>
+(compat-defun format-message (string &rest objects) ;; <OK>
   "Format a string out of a format-string and arguments.
 The first argument is a format control string.
 The other arguments are substituted into it to make the result, a string.
diff --git a/compat-27.el b/compat-27.el
index defa8d4493..ba3384af78 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -312,7 +312,7 @@ represent a JSON false value.  It defaults to `:false'."
 
 ;;;; Defined in timefns.c
 
-(compat-defun time-equal-p (t1 t2) ;; <UNTESTED>
+(compat-defun time-equal-p (t1 t2) ;; <OK>
   "Return non-nil if time value T1 is equal to time value T2.
 A nil value for either argument stands for the current time.
 
@@ -331,7 +331,7 @@ NOTE: This function is not as accurate as the actual 
`time-equal-p'."
 
 ;;;; Defined in fileio.c
 
-(compat-defun file-name-absolute-p (filename) ;; <UNTESTED>
+(compat-defun file-name-absolute-p (filename) ;; <OK>
   "Return t if FILENAME is an absolute file name.
 On Unix, absolute file names start with `/'.  In Emacs, an absolute
 file name can also start with an initial `~' or `~USER' component,
@@ -396,7 +396,7 @@ If you just want to check `major-mode', use 
`derived-mode-p'."
          (setq mode (if (and parentfn (symbolp parentfn)) parentfn parent)))))
   mode)
 
-(compat-defun derived-mode-p (&rest modes) ;; <UNTESTED>
+(compat-defun derived-mode-p (&rest modes) ;; <OK>
   "Non-nil if the current major mode is derived from one of MODES.
 Uses the `derived-mode-parent' property of the symbol to trace backwards."
   (apply #'provided-mode-derived-p major-mode modes))
@@ -707,7 +707,7 @@ The return value is a string (or nil in case we can’t find 
it)."
 
 ;;;; Defined in time-date.el
 
-(compat-defun date-days-in-month (year month) ;; <UNTESTED>
+(compat-defun date-days-in-month (year month) ;; <OK>
   "The number of days in MONTH in YEAR."
   :feature time-date
   (unless (and (numberp month)
diff --git a/compat-28.el b/compat-28.el
index 5df1b56327..3bbc2e5d3c 100644
--- a/compat-28.el
+++ b/compat-28.el
@@ -222,7 +222,7 @@ If COUNT is non-nil and a natural number, the function will
 
 ;;;; xfaces.c
 
-(compat-defun color-values-from-color-spec (spec) ;; <UNTESTED>
+(compat-defun color-values-from-color-spec (spec) ;; <OK>
   "Parse color SPEC as a numeric color and return (RED GREEN BLUE).
 This function recognises the following formats for SPEC:
 
diff --git a/compat-tests.el b/compat-tests.el
index 68010629cb..5d82569bba 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -46,6 +46,9 @@
 (defmacro should-equal (a b)
   `(should (equal ,a ,b)))
 
+(ert-deftest format-message ()
+  (should-equal (format-message "a=%s b=%s" 1 2) "a=1 b=2"))
+
 (defvar compat-local-a nil)
 (defvar compat-local-b nil)
 (defvar compat-local-c nil)
@@ -298,7 +301,7 @@
   (should-equal '((0 . zero) a (0 . zero)) (compat-call assoc-delete-all 0 
(list (cons 0 'zero) (cons 1 'one) 'a  (cons 0 'zero)) #'/=))
   (should-equal '(a (0 . zero) (0 . zero)) (compat-call assoc-delete-all 0 
(list 'a (cons 0 'zero) (cons 1 'one) (cons 0 'zero)) #'/=)))
 
-(ert-deftest provided-mode-derived-p ()
+(ert-deftest derived-mode-p ()
   (let ((one (make-symbol "1"))
         (two (make-symbol "2"))
         (three (make-symbol "3"))
@@ -319,7 +322,14 @@
     (should-equal two (provided-mode-derived-p three one.5 one two))
     (should-equal two (provided-mode-derived-p three one.5 two one))
     (should-equal three (provided-mode-derived-p three one.5 two one three))
-    (should-equal three (provided-mode-derived-p three one.5 three two one))))
+    (should-equal three (provided-mode-derived-p three one.5 three two one))
+    (let ((major-mode three))
+      (should-equal one (derived-mode-p one))
+      (should-equal one (derived-mode-p one.5 one))
+      (should-equal two (derived-mode-p one.5 one two))
+      (should-equal two (derived-mode-p one.5 two one))
+      (should-equal three (derived-mode-p one.5 two one three))
+      (should-equal three (derived-mode-p one.5 three two one)))))
 
 (ert-deftest format-prompt ()
   (should-equal "Prompt: " (format-prompt "Prompt" nil))



reply via email to

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