From: Marcin Borkowski <mbork@mbork.pl>
To: help-gnu-emacs@gnu.org
Subject: Re: ERT conventions?
Date: Sun, 06 Sep 2015 08:10:15 +0200 [thread overview]
Message-ID: <87pp1w13js.fsf@mbork.pl> (raw)
In-Reply-To: <878u8kce2s.fsf@gmail.com>
On 2015-09-06, at 07:27, Alexis <flexibeast@gmail.com> wrote:
> Marcin Borkowski <mbork@mbork.pl> writes:
>
>> Hi all,
>>
>> I'm learning the ERT package. I'd like to know whether there
>> are any conventions/good practices regarding writing tests.
>> Eg., should they be written in a file separate from the package?
>> (I guess yes, for obvious reasons.) Are there any standards for
>> the name of that file? In general: could anyone using ERT (or
>> any other testing facility, for that matter) share some
>> experiences worth knowing?
>
> i've found ERT pretty easy to use. For `org-vcard`, i've put the
> test suite in a single file within a distinct 'tests' folder,
> which also contains a 'data' folder containing various data
> sources for the tests to run on:
Thanks!
And it's not that ERT is difficult to use, no. What I'm asking is (for
instance): is it better to say
(ert-deftest my-function-test ()
"Tests the `my-function' function."
(with-temp-buffer
(insert "input")
(goto-char (point-min))
(should (this-be-satisfied)
(should (that-be-satisfied)))))
or maybe
(ert-deftest my-function-test ()
"Tests the `my-function' function."
(should (with-temp-buffer
(insert "input")
(goto-char (point-min))
(this-be-satisfied)))
(should (with-temp-buffer
(insert "input")
(goto-char (point-min))
(that-be-satisfied))))
?
The former avoids code repetition and probably is (a bit) faster; the
latter /might/ result in better reporting.
Etc.
> Alexis.
Best,
--
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University
next prev parent reply other threads:[~2015-09-06 6:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-06 5:01 ERT conventions? Marcin Borkowski
2015-09-06 5:27 ` Alexis
2015-09-06 6:10 ` Marcin Borkowski [this message]
2015-09-06 6:43 ` Alexis
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=87pp1w13js.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=help-gnu-emacs@gnu.org \
/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.
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).