[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dash 609ac28 245/316: Improve Texinfo markup when docum
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dash 609ac28 245/316: Improve Texinfo markup when documenting errors |
Date: |
Mon, 15 Feb 2021 15:58:10 -0500 (EST) |
branch: externals/dash
commit 609ac28bab13c7f8a107b0f2dc78353763c84086
Author: Basil L. Contovounesios <contovob@tcd.ie>
Commit: Basil L. Contovounesios <contovob@tcd.ie>
Improve Texinfo markup when documenting errors
* dev/examples-to-docs.el (example-to-string): Simplify.
* dev/examples-to-info.el (example-to-string): Use @error{} instead
of @result{} for errors. Use error-message-string to translate
error lists to their corresponding message.
* dev/examples-to-tests.el (example-to-should): Add support for
checking whole error lists, not just error symbols.
* dev/examples.el (-running-sum, -running-product, -iota): Specify
whole error list, not just error symbol.
* dash.texi: Regenerate.
---
dash.texi | 6 +++---
dev/examples-to-docs.el | 16 +++++++---------
dev/examples-to-info.el | 12 ++++++++----
dev/examples-to-tests.el | 6 ++++--
dev/examples.el | 6 +++---
5 files changed, 25 insertions(+), 21 deletions(-)
diff --git a/dash.texi b/dash.texi
index c6035bc..97969a6 100644
--- a/dash.texi
+++ b/dash.texi
@@ -1416,7 +1416,7 @@ Return a list with running sums of items in @var{list}.
@end group
@group
(-running-sum nil)
- @result{} wrong-type-argument
+ @error{} "Wrong type argument: consp, nil"
@end group
@end example
@end defun
@@ -1457,7 +1457,7 @@ Return a list with running products of items in
@var{list}.
@end group
@group
(-running-product nil)
- @result{} wrong-type-argument
+ @error{} "Wrong type argument: consp, nil"
@end group
@end example
@end defun
@@ -2727,7 +2727,7 @@ the @var{apl} language.
@end group
@group
(-iota -1)
- @result{} wrong-type-argument
+ @error{} "Wrong type argument: natnump, -1"
@end group
@end example
@end defun
diff --git a/dev/examples-to-docs.el b/dev/examples-to-docs.el
index d2ac648..0d30aee 100644
--- a/dev/examples-to-docs.el
+++ b/dev/examples-to-docs.el
@@ -30,16 +30,14 @@
(defvar functions ())
(defun example-to-string (example)
- (-let* (((actual sym expected) example)
- (comment
- (cond
- ((eq sym '=>) (format "=> %S" expected))
- ((eq sym '~>) (format "~> %S" expected))
- ((eq sym '!!>) (format "Error"))
- (t (error "Invalid test case: %S" `(,actual ,sym ,expected))))))
- (--> comment
+ (-let [(actual sym expected) example]
+ (--> (cond
+ ((eq sym '=>) (format "=> %S" expected))
+ ((eq sym '~>) (format "~> %S" expected))
+ ((eq sym '!!>) "Error")
+ ((error "Invalid test case: %S" example)))
(format "%S ;; %s" actual it)
- (replace-regexp-in-string "\\\\\\?" "?" it)
+ (replace-regexp-in-string "\\\\\\?" "?" it t t)
(replace-regexp-in-string "\n" "\\n" it t t)
(replace-regexp-in-string "\t" "\\t" it t t)
(replace-regexp-in-string "\r" "\\r" it t t))))
diff --git a/dev/examples-to-info.el b/dev/examples-to-info.el
index 67ee5af..a011a41 100644
--- a/dev/examples-to-info.el
+++ b/dev/examples-to-info.el
@@ -28,12 +28,16 @@
(setq text-quoting-style 'grave)
-(defvar functions '())
+(defvar functions ())
(defun example-to-string (example)
- (let ((actual (car example))
- (expected (nth 2 example)))
- (--> (format "@group\n%S\n @result{} %S\n@end group" actual expected)
+ (let ((actual (pop example))
+ (err (eq (pop example) '!!>))
+ (expected (pop example)))
+ (and err (consp expected)
+ (setq expected (error-message-string expected)))
+ (--> (format "@group\n%S\n %s %S\n@end group"
+ actual (if err "@error{}" "@result{}") expected)
(replace-regexp-in-string "\\\\\\?" "?" it)
(replace-regexp-in-string "{\"" "@{\"" it t t)
(replace-regexp-in-string "}\"" "@}\"" it t t)
diff --git a/dev/examples-to-tests.el b/dev/examples-to-tests.el
index 7673cbe..8fe6c02 100644
--- a/dev/examples-to-tests.el
+++ b/dev/examples-to-tests.el
@@ -28,10 +28,12 @@
`(should (equal ,actual ,expected)))
((eq sym '~>)
`(should (approx-equal ,actual ,expected)))
- ((eq sym '!!>)
+ ((not (eq sym '!!>))
+ (error "Invalid test case: %S" `(,actual ,sym ,expected)))
+ ((symbolp expected)
;; FIXME: Tests fail on Emacs 24-25 without `eval' for some reason.
`(should-error (eval ',actual ,lexical-binding) :type ',expected))
- ((error "Invalid test case: %S" `(,actual ,sym ,expected)))))
+ (`(should (equal (should-error ,actual) ',expected)))))
(defmacro defexamples (cmd &rest examples)
(let (tests)
diff --git a/dev/examples.el b/dev/examples.el
index d854224..f298300 100644
--- a/dev/examples.el
+++ b/dev/examples.el
@@ -472,7 +472,7 @@ new list."
(defexamples -running-sum
(-running-sum '(1 2 3 4)) => '(1 3 6 10)
(-running-sum '(1)) => '(1)
- (-running-sum ()) !!> wrong-type-argument)
+ (-running-sum ()) !!> (wrong-type-argument consp ()))
(defexamples -product
(-product '()) => 1
@@ -482,7 +482,7 @@ new list."
(defexamples -running-product
(-running-product '(1 2 3 4)) => '(1 2 6 24)
(-running-product '(1)) => '(1)
- (-running-product ()) !!> wrong-type-argument)
+ (-running-product ()) !!> (wrong-type-argument consp ()))
(defexamples -inits
(-inits '(1 2 3 4)) => '(nil (1) (1 2) (1 2 3) (1 2 3 4))
@@ -886,7 +886,7 @@ value rather than consuming a list to produce a single
value."
(defexamples -iota
(-iota 6) => '(0 1 2 3 4 5)
(-iota 4 2.5 -2) => '(2.5 0.5 -1.5 -3.5)
- (-iota -1) !!> wrong-type-argument
+ (-iota -1) !!> (wrong-type-argument natnump -1)
(-iota 0) => ()
(-iota 0 nil 0) => ()
(-iota 1 nil 0) => '(0)
- [elpa] externals/dash 2028805 302/316: Don't quote error messages in Texinfo examples, (continued)
- [elpa] externals/dash 2028805 302/316: Don't quote error messages in Texinfo examples, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 6c41b32 301/316: Move case-fold-search binding to where it's used, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1c711f1 303/316: Unquote results in Texinfo examples, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1bf9ddb 304/316: Makefile aesthetics, ELPA Syncer, 2021/02/15
- [elpa] externals/dash da0415b 312/316: * NEWS.md (2.18): Start news for upcoming release., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 5eea156 315/316: Absorb dash-functional into dash, ELPA Syncer, 2021/02/15
- [elpa] externals/dash eaf33b3 226/316: Add info-lookup-symbol support, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 565055e 229/316: * dash.el (---truthy?): Simplify., ELPA Syncer, 2021/02/15
- [elpa] externals/dash 97bd233 231/316: Use lexical binding for -grade-up/down, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 1152feb 237/316: Deprecate variadic -list, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 609ac28 245/316: Improve Texinfo markup when documenting errors,
ELPA Syncer <=
- [elpa] externals/dash 999cae9 253/316: Fix short-circuiting of --first, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 3726eb1 254/316: Improve the examples of -some, ELPA Syncer, 2021/02/15
- [elpa] externals/dash b0bef0f 276/316: Don't set text-quoting-style globally, ELPA Syncer, 2021/02/15
- [elpa] externals/dash bedc804 282/316: Improve function-to-info, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 9727f7c 288/316: Simplify Lisp -> Texinfo printing, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7b2584c 294/316: Simplify GitHub link creation, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 7048e68 296/316: Restore some newlines in docstrings, ELPA Syncer, 2021/02/15
- [elpa] externals/dash f6554c3 298/316: Unquote results in README examples, ELPA Syncer, 2021/02/15
- [elpa] externals/dash 39e5b12 306/316: Merge pull request #370 from blc/news, ELPA Syncer, 2021/02/15
- [elpa] externals/dash af21da3 307/316: * dash-functional.el: Fix Author header., ELPA Syncer, 2021/02/15