mirror of
https://github.com/git/git.git
synced 2024-11-08 15:19:28 +01:00
t-reftable-merged: add test for REFTABLE_FORMAT_ERROR
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> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
40c80eab83
commit
9a1fb8af98
@ -11,6 +11,7 @@ https://developers.google.com/open-source/licenses/bsd
|
||||
#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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user