Message ID | 20240807141608.4524-5-chandrapratap3519@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | t: port reftable/readwrite_test.c to the unit testing framework | expand |
diff --git a/t/unit-tests/t-reftable-readwrite.c b/t/unit-tests/t-reftable-readwrite.c index 7daf28ec6d..a5462441d3 100644 --- a/t/unit-tests/t-reftable-readwrite.c +++ b/t/unit-tests/t-reftable-readwrite.c @@ -773,6 +773,11 @@ static void t_write_key_order(void) check(!err); err = reftable_writer_add_ref(w, &refs[1]); check_int(err, ==, REFTABLE_API_ERROR); + + refs[0].update_index = 2; + err = reftable_writer_add_ref(w, &refs[0]); + check_int(err, ==, REFTABLE_API_ERROR); + reftable_writer_close(w); reftable_writer_free(w); strbuf_release(&buf);
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 <ps@pks.im> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com> --- t/unit-tests/t-reftable-readwrite.c | 5 +++++ 1 file changed, 5 insertions(+)