From: Patrick Steinhardt <ps@pks.im>
To: Seyi Kuforiji <kuforiji98@gmail.com>
Cc: git@vger.kernel.org, phillip.wood@dunelm.org.uk
Subject: Re: [PATCH v3 03/10] t/unit-tests: convert reftable block test to use clar
Date: Tue, 3 Jun 2025 16:18:32 +0200 [thread overview]
Message-ID: <aD8EOE1BWWfXxOij@pks.im> (raw)
In-Reply-To: <20250602122559.208780-4-kuforiji98@gmail.com>
On Mon, Jun 02, 2025 at 01:25:51PM +0100, Seyi Kuforiji wrote:
> diff --git a/t/unit-tests/t-reftable-block.c b/t/unit-tests/u-reftable-block.c
> similarity index 74%
> rename from t/unit-tests/t-reftable-block.c
> rename to t/unit-tests/u-reftable-block.c
> index 52f1dae1c9..5d1419b801 100644
> --- a/t/unit-tests/t-reftable-block.c
> +++ b/t/unit-tests/u-reftable-block.c
> @@ -6,14 +6,15 @@ license that can be found in the LICENSE file or at
> https://developers.google.com/open-source/licenses/bsd
> */
>
> -#include "test-lib.h"
> +#include "unit-test.h"
> +#include "lib-reftable-clar.h"
> #include "reftable/block.h"
> #include "reftable/blocksource.h"
> #include "reftable/constants.h"
> #include "reftable/reftable-error.h"
> #include "strbuf.h"
>
> -static void t_ref_block_read_write(void)
> +void test_reftable_block__index_read_write(void)
> {
> const int header_off = 21; /* random */
> struct reftable_record recs[30];
The name here still looks wrong to me. This is about writing ref blocks,
not index blocks.
> @@ -220,12 +222,12 @@ static void t_obj_block_read_write(void)
> struct reftable_buf block_data = REFTABLE_BUF_INIT;
>
> REFTABLE_CALLOC_ARRAY(block_data.buf, block_size);
> - check(block_data.buf != NULL);
> + cl_assert(block_data.buf != NULL);
> block_data.len = block_size;
>
> ret = block_writer_init(&bw, REFTABLE_BLOCK_TYPE_OBJ, (uint8_t *) block_data.buf, block_size,
> header_off, hash_size(REFTABLE_HASH_SHA1));
> - check(!ret);
> + cl_assert(ret == 0);
All of these could be retained as `cl_assert(!ret)`, which is more
idiomatic in our codebase. Either that, or these should use
`cl_assert_equal_i()` to give better diagnostics.
Patrick
next prev parent reply other threads:[~2025-06-03 14:18 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-02 12:25 [PATCH v3 00/10] t/unit-tests: convert unit-tests to use clar Seyi Kuforiji
2025-06-02 12:25 ` [PATCH v3 01/10] t/unit-tests: implement clar specific reftable test helper functions Seyi Kuforiji
2025-06-02 13:23 ` Kristoffer Haugsbakk
2025-06-02 12:25 ` [PATCH v3 02/10] t/unit-tests: convert reftable basics test to use clar test framework Seyi Kuforiji
2025-06-03 13:51 ` Patrick Steinhardt
2025-06-03 14:03 ` Seyi Kuforiji
2025-06-03 14:14 ` Patrick Steinhardt
2025-06-02 12:25 ` [PATCH v3 03/10] t/unit-tests: convert reftable block test to use clar Seyi Kuforiji
2025-06-03 14:18 ` Patrick Steinhardt [this message]
2025-06-02 12:25 ` [PATCH v3 04/10] t/unit-tests: convert reftable merged " Seyi Kuforiji
2025-06-02 12:25 ` [PATCH v3 05/10] t/unit-tests: convert reftable pq " Seyi Kuforiji
2025-06-02 12:25 ` [PATCH v3 06/10] t/unit-tests: convert reftable table " Seyi Kuforiji
2025-06-02 19:33 ` Junio C Hamano
2025-06-03 11:46 ` Seyi Kuforiji
2025-06-03 19:12 ` Junio C Hamano
2025-06-02 12:25 ` [PATCH v3 07/10] t/unit-tests: convert reftable readwrite " Seyi Kuforiji
2025-06-02 12:25 ` [PATCH v3 08/10] t/unit-tests: convert reftable record " Seyi Kuforiji
2025-06-02 12:25 ` [PATCH v3 09/10] t/unit-tests: convert reftable stack " Seyi Kuforiji
2025-06-02 12:25 ` [PATCH v3 10/10] t/unit-tests: finalize migration of reftable-related tests Seyi Kuforiji
2025-06-03 13:51 ` Patrick Steinhardt
2025-06-05 12:56 ` Seyi Kuforiji
2025-06-05 13:24 ` Patrick Steinhardt
2025-06-05 16:56 ` Junio C Hamano
2025-06-03 18:41 ` [PATCH v3 00/10] t/unit-tests: convert unit-tests to use clar Junio C Hamano
2025-06-04 10:09 ` Seyi Kuforiji
2025-06-04 10:09 ` Seyi Kuforiji
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=aD8EOE1BWWfXxOij@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
--cc=kuforiji98@gmail.com \
--cc=phillip.wood@dunelm.org.uk \
/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 NNTP newsgroup(s).