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

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

[elpa] externals/plz d4be5b2c29: Tests: Unwrap (and (should ...) ...)


From: ELPA Syncer
Subject: [elpa] externals/plz d4be5b2c29: Tests: Unwrap (and (should ...) ...)
Date: Thu, 29 Jun 2023 03:59:01 -0400 (EDT)

branch: externals/plz
commit d4be5b2c293c585ff79ffd5bc1a86fa441b23137
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>

    Tests: Unwrap (and (should ...) ...)
    
    SHOULDs shouldn't be inside ANDs.
    
    Also, use map-nested-elt.
---
 tests/test-plz.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/tests/test-plz.el b/tests/test-plz.el
index f420847130..f3b8207a38 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -93,6 +93,7 @@
 (require 'ert)
 (require 'json)
 (require 'let-alist)
+(require 'map)
 
 (require 'plz)
 
@@ -152,14 +153,14 @@ Also, any instance of \"URI-PREFIX\" in URL-PART is 
replaced with
 
 (defmacro plz-test-get-response (response)
   "Test parts of RESPONSE with `should'."
-  `(and (should (plz-response-p ,response))
-        (should (numberp (plz-response-version ,response)))
-        (should (eq 200 (plz-response-status ,response)))
-        (should (equal "application/json" (alist-get 'content-type 
(plz-response-headers ,response))))
-        (let* ((json (json-read-from-string (plz-response-body ,response)))
-               (headers (alist-get 'headers json))
-               (user-agent (alist-get 'User-Agent headers nil nil #'equal)))
-          (should (string-match "curl" user-agent)))))
+  `(progn
+     (should (plz-response-p ,response))
+     (should (numberp (plz-response-version ,response)))
+     (should (eq 200 (plz-response-status ,response)))
+     (should (equal "application/json" (alist-get 'content-type 
(plz-response-headers ,response))))
+     (should (string-match "curl"
+                           (map-nested-elt (json-read-from-string 
(plz-response-body ,response))
+                                           '(headers User-Agent))))))
 
 ;;;; Tests
 
@@ -399,9 +400,9 @@ Also, any instance of \"URI-PREFIX\" in URL-PART is 
replaced with
                     :else (lambda (e)
                             (setf err e)))))
     (plz-test-wait process)
-    (should (and (plz-error-p err)
-                 (equal '(6 . "Couldn't resolve host. The given remote host 
was not resolved.")
-                        (plz-error-curl-error err))))))
+    (should (plz-error-p err))
+    (should (equal '(6 . "Couldn't resolve host. The given remote host was not 
resolved.")
+                   (plz-error-curl-error err)))))
 
 ;; FIXME: This test works interactively but not in batch mode: it
 ;; stalls the Emacs process indefinitely, using either sleep-for or



reply via email to

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