From: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
To: phillip.wood@dunelm.org.uk
Cc: "Linus Arver" <linusa@google.com>,
git@vger.kernel.org, "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Josh Steadmon" <steadmon@google.com>,
"Calvin Wan" <calvinwan@google.com>
Subject: Re: [RFC PATCH 1/2] Add C TAP harness
Date: Thu, 29 Jun 2023 07:52:32 +0200 [thread overview]
Message-ID: <ZJ0cIKrSVmwMy6F4@ugly> (raw)
In-Reply-To: <a6dff108-6946-71e7-99dc-ac3b70f7d7fa@gmail.com>
On Mon, Jun 26, 2023 at 02:15:39PM +0100, Phillip Wood wrote:
>On 21/06/2023 16:57, Linus Arver wrote:
>> - Make the 'TEST' macro accept the test description first. Or, keep
>> the
>> 'TEST' macro but also name a new macro 'IT' that accepts the
>> description first, to encourage usage that reads in a
>> behavior-driven-development (BDD) style, like 'IT("should accept foo",
>> t_bar(...))'. I find some test descriptions easier to write this way.
>
>The test description is a printf style format string followed by
>arguments. This allows parameterized tests to include the parameter
>values in the description to aid debugging but it means the test
>function must be the first parameter. We could have IT("should accept
>%d", t(), i) but that would be a bit weird.
>
with some minor preprocessor magic [1], you could make that
IT(("should accept %d", i), t(i))
which would be somewhat more noisy, but arguably even somewhat clearer.
notably,
IT("should accept foo", t())
would still work with the same macro.
[1] https://stackoverflow.com/a/62984543/3685191
somewhat on a tangent: it's also possible to overload macros on argument
count [2], which may also come in handy.
[2] https://stackoverflow.com/a/24028231/3685191
regards,
ossi
next prev parent reply other threads:[~2023-06-29 5:52 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 17:50 [RFC PATCH 0/2] add an external testing library for unit tests Calvin Wan
2023-04-27 17:50 ` [RFC PATCH 1/2] Add C TAP harness Calvin Wan
2023-04-27 18:29 ` SZEDER Gábor
2023-04-27 18:38 ` Calvin Wan
2023-04-27 20:15 ` Phillip Wood
2023-04-28 16:31 ` Calvin Wan
2023-05-02 15:46 ` Felipe Contreras
2023-05-10 15:46 ` Phillip Wood
2023-05-11 23:16 ` Glen Choo
2023-05-18 10:04 ` Phillip Wood
2023-06-21 15:57 ` Linus Arver
2023-06-26 13:15 ` Phillip Wood
2023-06-28 21:17 ` Linus Arver
2023-06-29 5:52 ` Oswald Buddenhagen [this message]
2023-06-30 9:48 ` Phillip Wood
2023-05-02 15:54 ` Felipe Contreras
2023-05-02 16:39 ` Ævar Arnfjörð Bjarmason
2023-05-02 18:11 ` Felipe Contreras
2023-05-02 16:34 ` Ævar Arnfjörð Bjarmason
2023-05-10 8:18 ` Phillip Wood
2023-04-27 17:50 ` [RFC PATCH 2/2] unit test: add basic example Calvin Wan
2023-04-27 18:47 ` Junio C Hamano
2023-05-02 15:58 ` Felipe Contreras
2023-04-27 18:39 ` [RFC PATCH 0/2] add an external testing library for unit tests Junio C Hamano
2023-04-27 18:46 ` Calvin Wan
2023-04-27 21:35 ` brian m. carlson
2023-05-02 4:18 ` Felipe Contreras
2023-05-02 13:52 ` Ævar Arnfjörð Bjarmason
2023-05-02 15:28 ` Felipe Contreras
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=ZJ0cIKrSVmwMy6F4@ugly \
--to=oswald.buddenhagen@gmx.de \
--cc=avarab@gmail.com \
--cc=calvinwan@google.com \
--cc=git@vger.kernel.org \
--cc=linusa@google.com \
--cc=phillip.wood@dunelm.org.uk \
--cc=steadmon@google.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.
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).