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

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

[elpa] externals/dash 6ffcd89 299/316: Print actual error messages in RE


From: ELPA Syncer
Subject: [elpa] externals/dash 6ffcd89 299/316: Print actual error messages in README
Date: Mon, 15 Feb 2021 15:58:21 -0500 (EST)

branch: externals/dash
commit 6ffcd897ce2b05edc18fc46797027c64b3dbb5ad
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>

    Print actual error messages in README
    
    * dev/examples-to-docs.el (example-to-string): Print actual error
    message in expected result.
    * README.md: Regenerate.
---
 README.md               |  6 +++---
 dev/examples-to-docs.el | 12 ++++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index fc19a5b..f268123 100644
--- a/README.md
+++ b/README.md
@@ -1088,7 +1088,7 @@ Return a list with running sums of items in `list`.
 ```el
 (-running-sum '(1 2 3 4)) ;; => (1 3 6 10)
 (-running-sum '(1)) ;; => (1)
-(-running-sum ()) ;; Error
+(-running-sum ()) ;; Wrong type argument: consp, nil
 ```
 
 #### -product `(list)`
@@ -1109,7 +1109,7 @@ Return a list with running products of items in `list`.
 ```el
 (-running-product '(1 2 3 4)) ;; => (1 2 6 24)
 (-running-product '(1)) ;; => (1)
-(-running-product ()) ;; Error
+(-running-product ()) ;; Wrong type argument: consp, nil
 ```
 
 #### -inits `(list)`
@@ -1807,7 +1807,7 @@ the `apl` language.
 ```el
 (-iota 6) ;; => (0 1 2 3 4 5)
 (-iota 4 2.5 -2) ;; => (2.5 0.5 -1.5 -3.5)
-(-iota -1) ;; Error
+(-iota -1) ;; Wrong type argument: natnump, -1
 ```
 
 #### -zip-with `(fn list1 list2)`
diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index 8fc4567..983f8fb 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -44,9 +44,13 @@
 (defun example-to-string (example)
   (pcase-let ((`(,actual ,sym ,expected) example)
               (print-quoted t))
-    (and (eq (car-safe expected) 'quote)
-         (not (equal expected ''()))
-         (setq expected (cadr expected)))
+    (cond ((eq sym '!!>)
+           ;; Print actual error message.
+           (setq expected (error-message-string (-list expected))))
+          ((and (eq (car-safe expected) 'quote)
+                (not (equal expected ''())))
+           ;; Unquote expected result.
+           (setq expected (cadr expected))))
     (with-output-to-string
       (with-current-buffer standard-output
         (dash--print-lisp-as-md actual)
@@ -55,7 +59,7 @@
                (princ sym)
                (insert ?\s)
                (dash--print-lisp-as-md expected))
-              ((eq sym '!!>) (insert "Error"))
+              ((eq sym '!!>) (princ expected))
               ((error "Invalid test case: %S" example)))))))
 
 (defun dash--describe (fn)



reply via email to

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