Re: [PATCH 1/5] t/unit-tests: implement oid helper functions in unit-tests.{c,h}
Hi Seyi
On 20/02/2025 08:29, Seyi Kuforiji wrote:
Show 14 quoted lines
> +static void cl_parse_oid(const char *hex, struct object_id *oid,
> + const struct git_hash_algo *algop)
> +{
> + int ret;
> + size_t sz = strlen(hex);
> + struct strbuf buf = STRBUF_INIT;
> +
> + cl_assert(sz <= algop->hexsz);
> +
> + strbuf_add(&buf, hex, sz);
> + strbuf_addchars(&buf, '0', algop->hexsz - sz);
> +
> + ret = get_oid_hex_algop(buf.buf, oid, algop);
> + cl_assert_equal_i(ret, 0);These last two lines would be better written as
cl_assert_equal_i(get_oid_hex_algop(buf.buf, oid, algop), 0);
So that if it fails the message shows which function was being called
Best Wishes
Phillip