all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: Christian Ohler <ohler+emacs@fastmail.net>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	emacs-devel Mailinglist <emacs-devel@gnu.org>
Subject: Re: testing framework and package.el
Date: Tue, 05 Oct 2010 02:01:27 +0200	[thread overview]
Message-ID: <87mxqtmrs8.fsf@gmx.de> (raw)
In-Reply-To: <4CA9F483.8020000@fastmail.net> (Christian Ohler's message of "Tue, 05 Oct 2010 01:06:35 +0930")

Christian Ohler <ohler+emacs@fastmail.net> writes:
>  On 4/10/10 6:22, Sebastian Rose wrote:
> I suspect it would be easier if the convention was that a file /some/path/foo.el
> had its tests in /some/path/test/foo.el.  The convention of having a top-level
> src/ and test/ split makes sense in Java because of its package file layout and
> visibility rules, but Emacs Lisp has no such constraints.  Has anyone else
> thought about the pros and cons of these different conventions?  Is there a deep
> reason why Emacs currently has test/ as a separate top-level directory?


This would place many "test" directoies inside the source tree.  They
might get in the way of builds.

Emacs conventions are indeed naming conventions:  Start function names
whith the name of the "package", name the file like it, (provide
'PACKAGE) etc.


> I just rewrote the test buffer functionality.  The design is now more orthogonal
> and flexible, but reading input from files will require an explicit call to
> insert-file-contents' or similar.

That's not a big hurdle I guess.


> I see.  Comparing directory trees may be important to org-mode, but overall, it
> seems like a feature that would be used by the tests of only very few packages.
> I think you're better off writing some utility functions on top of ERT, as you
> have already started doing for other things.  Not every test-related utility
> function belongs in ERT itself; it's fine to build stuff on top.


OK.


> The `ert-info' feature that I just implemented allows you to add custom context
> information that ERT will display on test failures.  It's not documented in the
> manual yet, but it makes it easier to build the kind of test utilities that you
> may want, so please check it out.
>
>
>>> One limitations of my approach is that we really need some kind of
>>> "with-test-buffer" rather than "with-temp-buffer" that keeps the buffer around
>>> for inspection if the test fails, but this is item 2.) on your list already.
>>> Another limitation is that the explainer for `equal' is not as pretty as ediff,
>>> but OTOH, as soon as you want to compare text properties, ediff can't help
>>> anymore (AFAIK), while there is an explainer for
>>> ert-equal-including-properties'.
>> Also, I believe ediff is too interactive for a simple test run (diff's
>> exit status is 0 if no difference is found - don't know yet if and to
>> how ediff could be used non-interactively).
> I have a rough idea now how to extend ERT's "explanation" feature to allow
> interactive invocation of ediff to visualize differences; this seems like a good
> way to solve this.  Tests would simply use (should (equal string1 string2)), and
> the explainer for `equal' would take care of the rest, putting a button in the
> results buffer that allows the user to invoke ediff.  string1 and string2 could
> be the result of calling `buffer-string' on different buffers, of course.


+1



> OK, that makes sense.  It is important to write actual tests, though; ideas for
> improvement that come from experience with real-world problems carry much more
> weight than thought experiments.
>
> Christian.


Yes, true.



  Sebastian



  parent reply	other threads:[~2010-10-05  0:01 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-27 15:18 testing framework and package.el Sebastian Rose
2010-09-27 22:57 ` Stefan Monnier
2010-09-27 23:42   ` Sebastian Rose
2010-09-27 23:55   ` Sebastian Rose
2010-10-01 13:01   ` Christian Ohler
2010-10-02  3:53     ` Sebastian Rose
2010-10-03 10:51       ` Christian Ohler
2010-10-03 20:52         ` Sebastian Rose
2010-10-04 15:36           ` Christian Ohler
2010-10-04 16:48             ` Chong Yidong
2010-10-05  1:17               ` Christian Ohler
2010-10-05  1:38                 ` Lennart Borgman
2010-10-05  1:50                 ` Sebastian Rose
2010-10-05  3:31                   ` Christian Ohler
2010-10-05  4:39                 ` Stephen J. Turnbull
2010-10-05 16:43                   ` Eric Schulte
2010-10-05 23:18                     ` Stefan Monnier
2010-10-11  9:26                   ` Christian Ohler
2010-10-12  3:02                     ` Stephen J. Turnbull
2010-10-12  9:41                       ` Lennart Borgman
2010-10-12 13:39                         ` Stephen J. Turnbull
2010-10-12 16:28                           ` Lennart Borgman
2010-10-12 17:37                             ` Stephen J. Turnbull
2010-10-12 17:54                               ` Lennart Borgman
2010-10-13  0:36                               ` Stefan Monnier
2010-10-13  9:03                                 ` Stephen J. Turnbull
2010-10-13 10:00                                 ` Christian Ohler
2010-10-13 14:19                                   ` Stephen J. Turnbull
2010-10-17  6:37                                     ` Christian Ohler
2010-10-17 14:54                                       ` Stefan Monnier
2010-10-18  6:55                                       ` Stephen J. Turnbull
2010-10-12 14:36                         ` Christian Ohler
2010-10-12 17:41                           ` Stephen J. Turnbull
2010-10-13 10:00                             ` Christian Ohler
2010-10-13 14:13                               ` Stephen J. Turnbull
2010-10-17  6:37                                 ` Christian Ohler
2010-10-12 14:19                       ` Christian Ohler
2010-10-12 17:58                         ` Stephen J. Turnbull
2010-10-12 18:13                           ` Lennart Borgman
2010-10-13 10:00                           ` Christian Ohler
2010-10-04 17:22             ` Eric Schulte
2010-10-05  0:01             ` Sebastian Rose [this message]
2010-10-04 13:02     ` Masatake YAMATO
2010-10-05  3:29       ` Christian Ohler

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

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

  git send-email \
    --in-reply-to=87mxqtmrs8.fsf@gmx.de \
    --to=sebastian_rose@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=ohler+emacs@fastmail.net \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.