emacs-devel
[Top][All Lists]
Advanced

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

Re: automated indent tests


From: Stephen Leake
Subject: Re: automated indent tests
Date: Sun, 29 Nov 2015 11:50:55 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (windows-nt)

Dmitry Gutov <address@hidden> writes:

>> My package lets you do something like...
>>
>> (ert-deftest indent
>>     (should
>>        (sisyphus-indentation=
>>           'emacs-lisp-mode
>>           "emacs-lisp-indented.el"
>>           "emacs-lisp-unindented.el")))
>
> The .el extension points to emacs-lisp-mode already, doesn't it?

For tests where auto-mode-alists fails, we could require a file local
variable to set the mode. That would make it easier to debug the test
interactively as well.

> There's also the issue of customization variables that affect
> indentation: thus far we've put them into the files, but we might as
> well specify them programmatically here.

I prefer them in the files as file local variables; that makes it easier
to debug the test interactively.

Unless you want to use one unindented file, indent it with several
different indent options, and compare each result to a different
known-good file. That would be a good use case.

>> I hadn't thought of the idea of unindenting first -- I shall add that.
>
> Actually, having -unindented files seems largely unnecessary to me. I
> ported that idea straight from the test suite inside the Ruby core,
> but the benefits are relatively small, and that would double the
> number of files. But hey, we can try it both ways.

In some cases, the final indentation can depend on the starting point.
Certainly that will be true for languages where the syntax relies on the
indentation (Python etc).

So maybe allowing for both forms of test would be best.


For my ada-mode indentation tests, I store only the known-good file in
the resource directory, autmatically de-indent every line by two spaces,
then reindent and compare to the original. That has been sufficient so
far.

-- 
-- Stephe



reply via email to

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