]> git.proxmox.com Git - libgit2.git/blob - tests/config/config_helpers.c
Rename tests-clar to tests
[libgit2.git] / tests / config / config_helpers.c
1 #include "clar_libgit2.h"
2 #include "config_helpers.h"
3 #include "repository.h"
4
5 void assert_config_entry_existence(
6 git_repository *repo,
7 const char *name,
8 bool is_supposed_to_exist)
9 {
10 git_config *config;
11 const char *out;
12 int result;
13
14 cl_git_pass(git_repository_config__weakptr(&config, repo));
15
16 result = git_config_get_string(&out, config, name);
17
18 if (is_supposed_to_exist)
19 cl_git_pass(result);
20 else
21 cl_assert_equal_i(GIT_ENOTFOUND, result);
22 }
23
24 void assert_config_entry_value(
25 git_repository *repo,
26 const char *name,
27 const char *expected_value)
28 {
29 git_config *config;
30 const char *out;
31
32 cl_git_pass(git_repository_config__weakptr(&config, repo));
33
34 cl_git_pass(git_config_get_string(&out, config, name));
35
36 cl_assert_equal_s(expected_value, out);
37 }