]> git.ipfire.org Git - thirdparty/git.git/commit
t/unit-tests: convert oidmap test to use clar test framework
authorSeyi Kuforiji <kuforiji98@gmail.com>
Tue, 25 Feb 2025 10:10:43 +0000 (11:10 +0100)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Feb 2025 18:31:22 +0000 (10:31 -0800)
commit69bc044def16e8d8f85cd321b00ae53abe96a567
treef16ae6fc2eb2759406c26039ce56bcf1a270f1d5
parent869a1edf4470fab379fdead671036d6906112da2
t/unit-tests: convert oidmap test to use clar test framework

Adapt oidmap test script to clar framework by using clar assertions
where necessary. `cl_parse_any_oid()` ensures the hash algorithm is set
before parsing. This prevents issues from an uninitialized or invalid
hash algorithm.

Introduce 'test_oidmap__initialize` handles the to set up of the global
oidmap map with predefined key-value pairs, and `test_oidmap__cleanup`
frees the oidmap and its entries when all tests are completed.

The test loops through all entries to detect multiple errors. With this
change, it stops at the first error encountered, making it easier to
address it.

Mentored-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Seyi Kuforiji <kuforiji98@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Makefile
t/meson.build
t/unit-tests/t-oidmap.c [deleted file]
t/unit-tests/u-oidmap.c [new file with mode: 0644]