t-reftable-record: add ref tests for reftable_record_is_deletion()

reftable_record_is_deletion() is a function defined in reftable/record.{c, h} that determines whether a record is of type deletion or not. In the current testing setup, this function is left untested for all the four record types (ref, log, obj, index). Add tests for this function in the case of ref records. Mentored-by: Patrick Steinhardt <ps@pks.im> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com> Acked-by: Karthik Nayak <karthik.188@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Chandra Pratap committed Jul 2, 2024 at 12:52 UTC aa3fef4ff3df005c6ad5b524429caef57c7b00d6
1 file changed +2
t/unit-tests/t-reftable-record.c
+2
@@ -102,6 +102,7 @@ static void t_reftable_ref_record_roundtrip(void)
102 for (int i = REFTABLE_REF_DELETION; i < REFTABLE_NR_REF_VALUETYPES; i++) {
103 struct reftable_record in = {
104 .type = BLOCK_TYPE_REF,
105 + .u.ref.value_type = i,
106 };
107 struct reftable_record out = { .type = BLOCK_TYPE_REF };
108 struct strbuf key = STRBUF_INIT;
@@ -132,6 +133,7 @@ static void t_reftable_ref_record_roundtrip(void)
133 t_copy(&in);
134
135 check_int(reftable_record_val_type(&in), ==, i);
136 + check_int(reftable_record_is_deletion(&in), ==, i == REFTABLE_REF_DELETION);
137
138 reftable_record_key(&in, &key);
139 n = reftable_record_encode(&in, dest, GIT_SHA1_RAWSZ);