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: Gemini Lasswell
Subject: bug#24940: [PATCH] Add should-call, should-not-call, and their tests
Date: Sun, 13 Nov 2016 14:22:08 -0800

Hello,

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.

Attachment: 0001-Add-should-call-should-not-call-and-their-tests.patch
Description: Text document


reply via email to

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