summaryrefslogtreecommitdiffstats
path: root/t/unit-tests/t-reftable-readwrite.c
diff options
context:
space:
mode:
authorChandra Pratap <chandrapratap3519@gmail.com>2024-08-13 16:34:50 +0200
committerJunio C Hamano <gitster@pobox.com>2024-08-13 19:08:03 +0200
commit5e440bf7f1884e79f345225e55fbe3ccabf42b5a (patch)
treed5c2d075518c4cb4caf299287272279131a93b3a /t/unit-tests/t-reftable-readwrite.c
parentt-reftable-readwrite: use 'for' in place of infinite 'while' loops (diff)
downloadgit-5e440bf7f1884e79f345225e55fbe3ccabf42b5a.tar.xz
git-5e440bf7f1884e79f345225e55fbe3ccabf42b5a.zip
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 <ps@pks.im> Mentored-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Chandra Pratap <chandrapratap3519@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to '')
-rw-r--r--t/unit-tests/t-reftable-readwrite.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/t/unit-tests/t-reftable-readwrite.c b/t/unit-tests/t-reftable-readwrite.c
index 9a05dde9d6..2ce56a0523 100644
--- a/t/unit-tests/t-reftable-readwrite.c
+++ b/t/unit-tests/t-reftable-readwrite.c
@@ -774,6 +774,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);