[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#28209: Add tests for Edebug
From: |
npostavs |
Subject: |
bug#28209: Add tests for Edebug |
Date: |
Thu, 24 Aug 2017 20:13:56 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) |
severity 28209 wishlist
tags 28209 + patch
quit
Gemini Lasswell <gazally@runbox.com> writes:
> The first of the two attached patches extends ert-with-message-capture
> to catch the output of prin1, princ and print when it is destined for
> the echo area. Edebug uses prin1 and princ to show the results of
> evaluating expressions. I don't know why it uses them instead of
> message, and if there isn't a good reason for it, then modifying Edebug
> to use message instead of extending ert-with-message-capture is another
> option. If someone with a better understanding than mine of the
> difference between princ and message would like to take a look at it,
> the relevant code is in edebug-eval-expression and at the end of
> edebug-eval-defun.
I don't think there is any strong reason to use princ over message. It
indents a bit nicer I guess. But it's probably good to extend
ert-with-message-capture regardless.
> +(defmacro edebug-tests-deftest (name _args docstring &rest keys-and-body)
> + "Define an edebug unit test.
> +NAME is the name of the test, _ARGS should be nil, and DOCSTRING
> +is required. To avoid having to duplicate ERT's keyword parsing
> +here, its keywords and values (if any) must be inside a list
> +after the docstring, preceding the body, here combined with the
> +body in KEYS-AND-BODY."
I'm not sure it's worth the trouble to define a test-defining macro. Is
there really much advantage compared to just using a macro for each
body?
(ert-deftest foo ()
(edebug-tests-normal-env ...))
vs
(edebug-tests-deftest foo () ...)
> + (edebug-tests-should-be-at 'edebug-test-code-try-flavors "macro")
> + "i" (should (string-match-p "edebug-test-code-try-flavors is a built-in
> macro"
"built-in" is copy-pasta I guess?