Skip to content

Commit 5e440bf

Browse files
Chandra Pratapgitster
authored andcommitted
t-reftable-readwrite: add test for known error
When using reftable_writer_add_ref() to add a ref record to a reftable writer, The update_index of the ref record must be within the limits set by reftable_writer_set_limits(), or REFTABLE_API_ERROR is returned. This scenario is currently left untested. Add a test case for the same. Mentored-by: Patrick Steinhardt <[email protected]> Mentored-by: Christian Couder <[email protected]> Signed-off-by: Chandra Pratap <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 12f9ea4 commit 5e440bf

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,11 @@ static void t_write_key_order(void)
774774
check(!err);
775775
err = reftable_writer_add_ref(w, &refs[1]);
776776
check_int(err, ==, REFTABLE_API_ERROR);
777+
778+
refs[0].update_index = 2;
779+
err = reftable_writer_add_ref(w, &refs[0]);
780+
check_int(err, ==, REFTABLE_API_ERROR);
781+
777782
reftable_writer_close(w);
778783
reftable_writer_free(w);
779784
strbuf_release(&buf);

0 commit comments

Comments
 (0)