unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: Kaushal Modi <kaushal.modi@gmail.com>
Cc: Emacs developers <emacs-devel@gnu.org>
Subject: Re: testing macros and fixtures
Date: Tue, 13 Oct 2015 10:23:50 +0100	[thread overview]
Message-ID: <87h9lvt93t.fsf@russet.org.uk> (raw)
In-Reply-To: <CAFyQvY0Q_tHXt5M4avgBuOV85RU_0rUicVxLorMQ1gmAL9XMwg@mail.gmail.com> (Kaushal Modi's message of "Mon, 12 Oct 2015 22:54:54 -0400")


Okay. This is definately something worth looking at, then. I think
writing tests is probably too hard at the moment!

Phil

Kaushal Modi <kaushal.modi@gmail.com> writes:

> verilog-mode runs similar tests from outside emacs.
>
>>From the terminal, the verilog-mode functions are run in emacs batch mode
> on files in the tests/ dir and and the results are compared against the
> files in tests_ok/ dir (if I understand correctly).
>
> Repo on github which is then commited to emacs core:
> https://github.com/veripool/verilog-mode
>
> Perl script to run batch tests:
> https://github.com/veripool/verilog-mode/blob/master/batch_test.pl
>
>
> --
> Kaushal Modi
>
> On Mon, Oct 12, 2015 at 5:13 PM, Phillip Lord <phillip.lord@russet.org.uk>
> wrote:
>
>>
>> I have been thinking about testing since it was raised in one of the
>> last gargantuan threads.
>>
>> ERT is quite nice, but one of the things that I have found lacking is a
>> nice set of predicates, for use within should.
>>
>> So, when I wrote test for my "lentic" package I needed some functions
>> like, so that I could do things like:
>>
>> (should
>>   (test-eq-after-this
>>      "blah-before.txt"
>>      "blah-after.txt"
>>      (insert "hello")))
>>
>> which opens "blah-before.txt" runs (insert "hello") then compares the
>> result with "blah-after.txt". My version of this also does a diff of the
>> results if the two are not equal.
>>
>> I've noticed that "puppet-mode" has some thing similar. For instance:
>>
>> (puppet-test-with-temp-buffer "# class
>> bar"
>>     (should (eq (puppet-test-face-at 1) 'font-lock-comment-delimiter-face))
>>     (should (eq (puppet-test-face-at 3) 'font-lock-comment-face))
>>     (should (eq (puppet-test-face-at 7) 'font-lock-comment-face))
>>     (should (eq (puppet-test-face-at 8) 'font-lock-comment-face))
>>     (should-not (puppet-test-face-at 9))))
>>
>> And julia-mode has indentation checking tests like so:
>>
>>    (julia--should-indent
>>      "
>> if foo
>>     bar
>> else
>> baz
>> end"
>>      "
>> if foo
>>     bar
>> else
>>     baz
>> end"))
>>
>>
>> My own experience is that these are actually quite hard to right. The
>> ones in lentic have never worked quite right -- that is, when it all
>> works they are fine, but restoring state after a crash doesn't always
>> work. Similarly, checking that, for example, test files are not already
>> open before a test is run interactively.
>>
>> So, the point of my question is this; are there any good libraries
>> providing this kind of fixture logic? A lot of this should surely be
>> re-usable between different packages.
>>
>> Phil
>>
>>
>>
>>
>>



  reply	other threads:[~2015-10-13  9:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-12 21:13 testing macros and fixtures Phillip Lord
2015-10-13  2:54 ` Kaushal Modi
2015-10-13  9:23   ` Phillip Lord [this message]
2015-10-13  9:16 ` Artur Malabarba
2015-10-13 11:34   ` Phillip Lord

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h9lvt93t.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=emacs-devel@gnu.org \
    --cc=kaushal.modi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).