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

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

[elpa] externals/compat 3205e470ba 2/4: Fix compat--expect handling of e


From: ELPA Syncer
Subject: [elpa] externals/compat 3205e470ba 2/4: Fix compat--expect handling of error specifications with error data
Date: Sat, 12 Mar 2022 12:57:21 -0500 (EST)

branch: externals/compat
commit 3205e470baaec8ae3d422c1ed0619f5ab2a01671
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>

    Fix compat--expect handling of error specifications with error data
---
 compat-tests.el | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/compat-tests.el b/compat-tests.el
index 93621c33f2..2a2475159b 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -71,9 +71,10 @@ being compared against."
   "Implementation for the `expect' macro for NAME.
 COMPAT is the name of the compatibility function the behaviour is
 being compared against."
-  (lambda (code &rest args)
+  (lambda (error-spec &rest args)
     (let ((real-test (intern (format "compat-%s-%04d-actual" name 
compat-test-counter)))
-          (comp-test (intern (format "compat-%s-%04d-compat" name 
compat-test-counter))))
+          (comp-test (intern (format "compat-%s-%04d-compat" name 
compat-test-counter)))
+          (error-type (if (consp error-spec) (car error-spec) error-spec)))
       (setq compat-test-counter (1+ compat-test-counter))
       (macroexp-progn
        (list (and (fboundp name)
@@ -85,7 +86,12 @@ being compared against."
                       :name ',real-test
                       :tags '(,name)
                       :body (lambda ()
-                              (should-error (,name ,@args) :type ,code))))))
+                              (should
+                               (let ((res (should-error (,name ,@args) :type 
',error-type)))
+                                 (should
+                                  ,(if (consp error-spec)
+                                       `(equal res ',error-spec)
+                                     `(eq (car res) ',error-spec))))))))))
              (and (fboundp compat)
                   `(ert-set-test
                     ',comp-test
@@ -93,7 +99,12 @@ being compared against."
                      :name ',comp-test
                      :tags '(,name)
                      :body (lambda ()
-                             (should-error (,compat ,@args) :type 
,code))))))))))
+                             (should
+                              (let ((res (should-error (,name ,@args) :type 
',error-type)))
+                                (should
+                                 ,(if (consp error-spec)
+                                      `(equal res ',error-spec)
+                                    `(eq (car res) ',error-spec))))))))))))))
 
 (defmacro compat-deftest (name &rest body)
   "Test NAME in BODY."



reply via email to

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