]>
git.proxmox.com Git - libgit2.git/blob - tests/libgit2/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 git_buf buf
= GIT_BUF_INIT
;
14 cl_git_mkfile(TEST_CONFIG
, "");
15 cl_git_pass(git_config_open_ondisk(&config
, TEST_CONFIG
));
17 cl_git_pass(git_config_set_string(config
, "color.ui", "auto"));
18 cl_git_pass(git_config_set_string(config
, "core.editor", "ed"));
20 git_config_free(config
);
22 cl_git_pass(git_config_open_ondisk(&config
, TEST_CONFIG
));
24 cl_git_pass(git_config_get_string_buf(&buf
, config
, "color.ui"));
25 cl_assert_equal_s("auto", buf
.ptr
);
26 git_buf_dispose(&buf
);
27 cl_git_pass(git_config_get_string_buf(&buf
, config
, "core.editor"));
28 cl_assert_equal_s("ed", buf
.ptr
);
30 git_buf_dispose(&buf
);
31 git_config_free(config
);
33 cl_must_pass(p_unlink(TEST_CONFIG
));