Print actual error messages in README

* dev/examples-to-docs.el (example-to-string): Print actual error
message in expected result.
* README.md: Regenerate.
master
Basil L. Contovounesios 5 years ago
parent f6554c3701
commit 6ffcd897ce
No known key found for this signature in database
GPG Key ID: 205AB54A5D5D8CFF
  1. 6
      README.md
  2. 12
      dev/examples-to-docs.el

@ -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)`

@ -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)

Loading…
Cancel
Save