summaryrefslogtreecommitdiff
path: root/tests-clar/config/backend.c
blob: 1cf7702632373254ddffb70b4aa00012108b6203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "clar_libgit2.h"

void test_config_backend__checks_version(void)
{
	git_config *cfg;
	git_config_backend backend = GIT_CONFIG_BACKEND_INIT;
	backend.version = 1024;
	const git_error *err;

	cl_git_pass(git_config_new(&cfg));
	cl_git_fail(git_config_add_backend(cfg, &backend, 0, false));
	err = giterr_last();
	cl_assert_equal_i(GITERR_INVALID, err->klass);

	giterr_clear();
	backend.version = 1024;
	cl_git_fail(git_config_add_backend(cfg, &backend, 0, false));
	err = giterr_last();
	cl_assert_equal_i(GITERR_INVALID, err->klass);
}