[Top][All Lists]

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

Re: Running ert tests on buffers in rst.el and elsewhere

From: Stefan Merten
Subject: Re: Running ert tests on buffers in rst.el and elsewhere
Date: Mon, 25 Jun 2012 11:20:38 +0200

Hi StefanMo, Christian, all!

6 days ago Stefan Monnier wrote:
>> I wanted to test functions which operate on buffers - i.e. use buffer
>> content as input and possibly modify the buffer. Buffer includes point
>> and mark in this case. Since I found no support for this requirement
>> in the ert package I wrote some support code for it. I just polished
>> it a bit to better fit into Emacs standards.
> Sounds OK.  The code looks mostly OK, except:
> - It should either use (require 'cl-lib) or (eval-when-compile (require 'cl)).


> - You can use the "--" convention for internal functions/variables
>   (e.g. use ert--equal-buffer instead of ert-equal-buffer-internal).


> - ert-Buf-create-string could probably use car-less-than-car if a speed
>   boost is needed (probably not worth the trouble, tho).

Indeed not worth the trouble.

> - the docstrings talk about "run list FOO" which is meaningless to me
>   (a list can't be run).  So describe FUNCALL a bit better (e.g. making
>   it clear that it's expected to have the shape (FUN . ARGS)).

I improved the whole documentation including a commentary section
describing how to use it.

I also revamped and refactored a few other things and added more

Most important changes are that `ert-equal-buffer' /
`ert-equal-buffer-return' are now macros so the form given as argument
needs not be quoted. Also these macros accept more parameters
including an option to say "the expected buffer should be the same as
the input buffer".

I include the code below.



Attachment: ert-buffer.el
Description: Implementation

Attachment: buffer.el
Description: Tests

Attachment: pgpek3tj1yG5Y.pgp
Description: PGP signature

reply via email to

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