Skip to content

Commit 5b539a5

Browse files
Chandra Pratapgitster
authored andcommitted
t: move reftable/readwrite_test.c to the unit testing framework
reftable/readwrite_test.c exercises the functions defined in reftable/reader.{c,h} and reftable/writer.{c,h}. Migrate reftable/readwrite_test.c to the unit testing framework. Migration involves refactoring the tests to use the unit testing framework instead of reftable's test framework and renaming the tests to align with unit-tests' naming conventions. Since some tests in reftable/readwrite_test.c use the functions set_test_hash(), noop_flush() and strbuf_add_void() defined in reftable/test_framework.{c,h} but these files are not #included in the ported unit test, copy these functions in the new test file. While at it, ensure structs are 0-initialized with '= { 0 }' instead of '= { NULL }'. 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 406f326 commit 5b539a5

File tree

4 files changed

+210
-212
lines changed

4 files changed

+210
-212
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1341,6 +1341,7 @@ UNIT_TEST_PROGRAMS += t-oidtree
13411341
UNIT_TEST_PROGRAMS += t-prio-queue
13421342
UNIT_TEST_PROGRAMS += t-reftable-basics
13431343
UNIT_TEST_PROGRAMS += t-reftable-merged
1344+
UNIT_TEST_PROGRAMS += t-reftable-readwrite
13441345
UNIT_TEST_PROGRAMS += t-reftable-record
13451346
UNIT_TEST_PROGRAMS += t-strbuf
13461347
UNIT_TEST_PROGRAMS += t-strcmp-offset
@@ -2682,7 +2683,6 @@ REFTABLE_OBJS += reftable/writer.o
26822683
REFTABLE_TEST_OBJS += reftable/block_test.o
26832684
REFTABLE_TEST_OBJS += reftable/dump.o
26842685
REFTABLE_TEST_OBJS += reftable/pq_test.o
2685-
REFTABLE_TEST_OBJS += reftable/readwrite_test.o
26862686
REFTABLE_TEST_OBJS += reftable/stack_test.o
26872687
REFTABLE_TEST_OBJS += reftable/test_framework.o
26882688
REFTABLE_TEST_OBJS += reftable/tree_test.o

reftable/reftable-tests.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ int basics_test_main(int argc, const char **argv);
1313
int block_test_main(int argc, const char **argv);
1414
int pq_test_main(int argc, const char **argv);
1515
int record_test_main(int argc, const char **argv);
16-
int readwrite_test_main(int argc, const char **argv);
1716
int stack_test_main(int argc, const char **argv);
1817
int tree_test_main(int argc, const char **argv);
1918
int reftable_dump_main(int argc, char *const *argv);

t/helper/test-reftable.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ int cmd__reftable(int argc, const char **argv)
88
block_test_main(argc, argv);
99
tree_test_main(argc, argv);
1010
pq_test_main(argc, argv);
11-
readwrite_test_main(argc, argv);
1211
stack_test_main(argc, argv);
1312
return 0;
1413
}

0 commit comments

Comments
 (0)