]> git.proxmox.com Git - libgit2.git/blob - tests-clar/config/new.c
Update test suite
[libgit2.git] / tests-clar / config / new.c
1 #include "clar_libgit2.h"
2
3 #include "filebuf.h"
4 #include "fileops.h"
5 #include "posix.h"
6
7 #define TEST_CONFIG "git-new-config"
8
9 void test_config_new__write_new_config(void)
10 {
11 const char *out;
12 struct git_config_file *file;
13 git_config *config;
14
15 cl_git_pass(git_config_file__ondisk(&file, TEST_CONFIG));
16 cl_git_pass(git_config_new(&config));
17 cl_git_pass(git_config_add_file(config, file, 0));
18
19 cl_git_pass(git_config_set_string(config, "color.ui", "auto"));
20 cl_git_pass(git_config_set_string(config, "core.editor", "ed"));
21
22 git_config_free(config);
23
24 cl_git_pass(git_config_file__ondisk(&file, TEST_CONFIG));
25 cl_git_pass(git_config_new(&config));
26 cl_git_pass(git_config_add_file(config, file, 0));
27
28 cl_git_pass(git_config_get_string(config, "color.ui", &out));
29 cl_assert_equal_s(out, "auto");
30 cl_git_pass(git_config_get_string(config, "core.editor", &out));
31 cl_assert_equal_s(out, "ed");
32
33 git_config_free(config);
34
35 p_unlink(TEST_CONFIG);
36 }