Skip to content

Commit aa3fef4

Browse files
Chandra Pratapgitster
authored andcommitted
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 <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Chandra Pratap <[email protected]> Acked-by: Karthik Nayak <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent abb1834 commit aa3fef4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

t/unit-tests/t-reftable-record.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ static void t_reftable_ref_record_roundtrip(void)
102102
for (int i = REFTABLE_REF_DELETION; i < REFTABLE_NR_REF_VALUETYPES; i++) {
103103
struct reftable_record in = {
104104
.type = BLOCK_TYPE_REF,
105+
.u.ref.value_type = i,
105106
};
106107
struct reftable_record out = { .type = BLOCK_TYPE_REF };
107108
struct strbuf key = STRBUF_INIT;
@@ -132,6 +133,7 @@ static void t_reftable_ref_record_roundtrip(void)
132133
t_copy(&in);
133134

134135
check_int(reftable_record_val_type(&in), ==, i);
136+
check_int(reftable_record_is_deletion(&in), ==, i == REFTABLE_REF_DELETION);
135137

136138
reftable_record_key(&in, &key);
137139
n = reftable_record_encode(&in, dest, GIT_SHA1_RAWSZ);

0 commit comments

Comments
 (0)