File: new.c

package info (click to toggle)
libgit2 0.27.7%2Bdfsg.1-0.2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 31,400 kB
  • sloc: ansic: 157,824; sh: 406; python: 182; php: 65; makefile: 61
file content (34 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "clar_libgit2.h"

#include "filebuf.h"
#include "fileops.h"
#include "posix.h"

#define TEST_CONFIG "git-new-config"

void test_config_new__write_new_config(void)
{
	git_config *config;
	git_buf buf = GIT_BUF_INIT;

	cl_git_mkfile(TEST_CONFIG, "");
	cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));

	cl_git_pass(git_config_set_string(config, "color.ui", "auto"));
	cl_git_pass(git_config_set_string(config, "core.editor", "ed"));

	git_config_free(config);

	cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG));

	cl_git_pass(git_config_get_string_buf(&buf, config, "color.ui"));
	cl_assert_equal_s("auto", git_buf_cstr(&buf));
	git_buf_clear(&buf);
	cl_git_pass(git_config_get_string_buf(&buf, config, "core.editor"));
	cl_assert_equal_s("ed", git_buf_cstr(&buf));

	git_buf_free(&buf);
	git_config_free(config);

	p_unlink(TEST_CONFIG);
}