@@ -11,6 +11,7 @@ license that can be found in the LICENSE file or at
#include "reftable/constants.h"
#include "reftable/merged.h"
#include "reftable/reader.h"
+#include "reftable/reftable-error.h"
#include "reftable/reftable-generic.h"
#include "reftable/reftable-merged.h"
#include "reftable/reftable-writer.h"
@@ -440,6 +441,8 @@ static void t_default_write_opts(void)
check_int(hash_id, ==, GIT_SHA1_FORMAT_ID);
reftable_table_from_reader(&tab[0], rd);
+ err = reftable_new_merged_table(&merged, tab, 1, GIT_SHA256_FORMAT_ID);
+ check_int(err, ==, REFTABLE_FORMAT_ERROR);
err = reftable_new_merged_table(&merged, tab, 1, GIT_SHA1_FORMAT_ID);
check(!err);
When calling reftable_new_merged_table(), if the hash ID of the passed reftable_table parameter doesn't match the passed hash_id parameter, a REFTABLE_FORMAT_ERROR is thrown. This case is currently left unexercised, so add a test 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-merged.c | 3 +++ 1 file changed, 3 insertions(+)