aboutsummaryrefslogtreecommitdiffstats
path: root/t/unit-tests/t-reftable-readwrite.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-10-17 06:54:02 +0200
committerTaylor Blau <me@ttaylorr.com>2024-10-17 16:59:56 -0400
commit31eedd1d115c086a84aaa5b53b14294d0afda4ae (patch)
tree0bc2bc18ff3f26e6be312e30c454db109490c00d /t/unit-tests/t-reftable-readwrite.c
parentf177d491637a3771f19055cb3873bda9c163c91a (diff)
downloadgit-31eedd1d115c086a84aaa5b53b14294d0afda4ae.tar.gz
t/unit-tests: check for `reftable_buf` allocation errors
Adapt our unit tests to check for allocations errors. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Taylor Blau <me@ttaylorr.com>
Diffstat (limited to 't/unit-tests/t-reftable-readwrite.c')
-rw-r--r--t/unit-tests/t-reftable-readwrite.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/t/unit-tests/t-reftable-readwrite.c b/t/unit-tests/t-reftable-readwrite.c
index 7c7c72bb16..d279b86df0 100644
--- a/t/unit-tests/t-reftable-readwrite.c
+++ b/t/unit-tests/t-reftable-readwrite.c
@@ -23,7 +23,7 @@ static void t_buffer(void)
struct reftable_block out = { 0 };
int n;
uint8_t in[] = "hello";
- reftable_buf_add(&buf, in, sizeof(in));
+ check(!reftable_buf_add(&buf, in, sizeof(in)));
block_source_from_buf(&source, &buf);
check_int(block_source_size(&source), ==, 6);
n = block_source_read_block(&source, &out, 0, sizeof(in));
@@ -443,8 +443,8 @@ static void t_table_read_write_seek(int index, int hash_id)
reftable_iterator_destroy(&it);
}
- reftable_buf_addstr(&pastLast, names[N - 1]);
- reftable_buf_addstr(&pastLast, "/");
+ check(!reftable_buf_addstr(&pastLast, names[N - 1]));
+ check(!reftable_buf_addstr(&pastLast, "/"));
err = reftable_reader_init_ref_iterator(reader, &it);
check(!err);
@@ -901,7 +901,7 @@ static void t_corrupt_table(void)
struct reftable_block_source source = { 0 };
struct reftable_reader *reader;
int err;
- reftable_buf_add(&buf, zeros, sizeof(zeros));
+ check(!reftable_buf_add(&buf, zeros, sizeof(zeros)));
block_source_from_buf(&source, &buf);
err = reftable_reader_new(&reader, &source, "file.log");