bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#24940: [PATCH] Add should-call, should-not-call, and their tests


From: Phillip Lord
Subject: bug#24940: [PATCH] Add should-call, should-not-call, and their tests
Date: Mon, 14 Nov 2016 16:18:22 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

That's interesting. I'm probably going to add my own package, assess, to
ELPA soon, and then to core, which has some similar functionality.

https://github.com/phillord/assess

Out of curiosity, would assess have fulfilled your use case also?

Gemini Lasswell <gazally@runbox.com> writes:
> In the process of writing tests for kmacro.el, I wrote two macros,
> should-call and should-not-call, that create context by temporarily
> adding advice to named functions. They allow a test writer to express
> expectations of how functions are used, to mock up responses of those
> functions to the code under test, and to prevent functions from running
> which might modify the global state of Emacs in an undesirable way
> during a test.
>
> I think that these macros would be useful additions to ERT. Here is a
> patch containing versions of the macros which are integrated into ERT
> and which provide better failure reporting than the ones that I included
> with the kmacro-tests.el patch in bug#24939.
>
> I also rewrote one test from files-tests.el as an example of usage and
> included it with the patch. It shows how the macros can help make the
> logic of a test clearer by removing the clutter of extra variables used
> to keep track of the arguments passed in function calls made by the code
> under test. For more examples, see the kmacro-tests.el patch in
> bug#24939.
>
> Let me know if you see ways to make this code better, or if there's any
> part of adding functionality to Emacs that I've missed here.





reply via email to

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