]>
git.proxmox.com Git - libgit2.git/blob - tests-clar/config/new.c
1 #include "clar_libgit2.h"
7 #define TEST_CONFIG "git-new-config"
9 void test_config_new__write_new_config(void)
12 struct git_config_file
*file
;
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));
19 cl_git_pass(git_config_set_string(config
, "color.ui", "auto"));
20 cl_git_pass(git_config_set_string(config
, "core.editor", "ed"));
22 git_config_free(config
);
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));
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");
33 git_config_free(config
);
35 p_unlink(TEST_CONFIG
);