MCPcopy Index your code
hub / github.com/git/git / test_reftable_stack__log_normalize

Function test_reftable_stack__log_normalize

t/unit-tests/u-reftable-stack.c:670–721  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

668}
669
670void test_reftable_stack__log_normalize(void)
671{
672 struct reftable_write_options opts = {
673 0,
674 };
675 struct reftable_stack *st = NULL;
676 char *dir = get_tmp_dir(__LINE__);
677 struct reftable_log_record input = {
678 .refname = (char *) "branch",
679 .update_index = 1,
680 .value_type = REFTABLE_LOG_UPDATE,
681 .value = {
682 .update = {
683 .new_hash = { 1 },
684 .old_hash = { 2 },
685 },
686 },
687 };
688 struct reftable_log_record dest = {
689 .update_index = 0,
690 };
691 struct write_log_arg arg = {
692 .log = &input,
693 .update_index = 1,
694 };
695
696 cl_assert_equal_i(reftable_new_stack(&st, dir, &opts), 0);
697
698 input.value.update.message = (char *) "one\ntwo";
699 cl_assert_equal_i(reftable_stack_add(st, write_test_log,
700 &arg, 0), REFTABLE_API_ERROR);
701
702 input.value.update.message = (char *) "one";
703 cl_assert_equal_i(reftable_stack_add(st, write_test_log,
704 &arg, 0), 0);
705 cl_assert_equal_i(reftable_stack_read_log(st, input.refname,
706 &dest), 0);
707 cl_assert_equal_s(dest.value.update.message, "one\n");
708
709 input.value.update.message = (char *) "two\n";
710 arg.update_index = 2;
711 cl_assert_equal_i(reftable_stack_add(st, write_test_log,
712 &arg, 0), 0);
713 cl_assert_equal_i(reftable_stack_read_log(st, input.refname,
714 &dest), 0);
715 cl_assert_equal_s(dest.value.update.message, "two\n");
716
717 /* cleanup */
718 reftable_stack_destroy(st);
719 reftable_log_record_release(&dest);
720 clear_dir(dir);
721}
722
723void test_reftable_stack__tombstone(void)
724{

Callers

nothing calls this directly

Calls 7

get_tmp_dirFunction · 0.85
reftable_new_stackFunction · 0.85
reftable_stack_addFunction · 0.85
reftable_stack_read_logFunction · 0.85
reftable_stack_destroyFunction · 0.85
clear_dirFunction · 0.85

Tested by

no test coverage detected