unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* ert: Where to define tests?
@ 2013-06-27 23:21 Moritz Ulrich
  2013-06-28  2:49 ` Xue Fuqiao
  2013-07-01 10:53 ` Andreas Röhler
  0 siblings, 2 replies; 3+ messages in thread
From: Moritz Ulrich @ 2013-06-27 23:21 UTC (permalink / raw)
  To: emacs-devel

This question came up in irc today:

Where should one define ert tests?

- In a separate file, to keep the source clean?
- In the source files itself?
  - Should the file (require 'ert)?
  - (eval-after-load 'ert '(...))?

It doesn't look like this is documented. If there's a consent on this,
it should be documented in the ert Info page as well as in the info
page about packaging.

Cheers,
Moritz Ulrich



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ert: Where to define tests?
  2013-06-27 23:21 ert: Where to define tests? Moritz Ulrich
@ 2013-06-28  2:49 ` Xue Fuqiao
  2013-07-01 10:53 ` Andreas Röhler
  1 sibling, 0 replies; 3+ messages in thread
From: Xue Fuqiao @ 2013-06-28  2:49 UTC (permalink / raw)
  To: Moritz Ulrich; +Cc: emacs-devel

On Fri, Jun 28, 2013 at 7:21 AM, Moritz Ulrich <moritz@tarn-vedra.de> wrote:
> This question came up in irc today:
>
> Where should one define ert tests?
>
> - In a separate file, to keep the source clean?

I think so.  See test/automated/[fn:1] for examples.

>   - (eval-after-load 'ert '(...))?

Well, we do not recommend to use `eval-after-load'.  (See
https://github.com/xfq/emacs-contributor-guide/issues/1)

> It doesn't look like this is documented. If there's a consent on this,
> it should be documented in the ert Info page as well as in the info
> page about packaging.

+1

Footnotes:

[fn:1] http://git.savannah.gnu.org/cgit/emacs.git/tree/test/automated

--
Best regards, Xue Fuqiao.
http://www.gnu.org/software/emacs/



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: ert: Where to define tests?
  2013-06-27 23:21 ert: Where to define tests? Moritz Ulrich
  2013-06-28  2:49 ` Xue Fuqiao
@ 2013-07-01 10:53 ` Andreas Röhler
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Röhler @ 2013-07-01 10:53 UTC (permalink / raw)
  To: emacs-devel

Am 28.06.2013 01:21, schrieb Moritz Ulrich:
> This question came up in irc today:
>
> Where should one define ert tests?
>
> - In a separate file, to keep the source clean?
> - In the source files itself?
>    - Should the file (require 'ert)?
>    - (eval-after-load 'ert '(...))?
>
> It doesn't look like this is documented. If there's a consent on this,
> it should be documented in the ert Info page as well as in the info
> page about packaging.
>
> Cheers,
> Moritz Ulrich
>
>

Hi Moritz,

IMHO there is no general answer, while mostly a separate file seems preferable. Writing tests might introduce bugs inside tests, which should not affect the source.

OTOH in some cases it might make sense not to use a source until tests passed.
Then making it part of the source seems consequent.

Cheers,

Andreas





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-01 10:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-27 23:21 ert: Where to define tests? Moritz Ulrich
2013-06-28  2:49 ` Xue Fuqiao
2013-07-01 10:53 ` Andreas Röhler

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).