Welcome to mirror list, hosted at ThFree Co, Russian Federation.

new.c « config « tests-clar - github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: fae3ce9419f59e67c856f2b6da302227d22323bc (plain)
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
35
36
#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)
{
	const char *out;
	struct git_config_file *file;
	git_config *config;

	cl_git_pass(git_config_file__ondisk(&file, TEST_CONFIG));
	cl_git_pass(git_config_new(&config));
	cl_git_pass(git_config_add_file(config, file, 0));

	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_file__ondisk(&file, TEST_CONFIG));
	cl_git_pass(git_config_new(&config));
	cl_git_pass(git_config_add_file(config, file, 0));

	cl_git_pass(git_config_get_string(&out, config, "color.ui"));
	cl_assert_equal_s(out, "auto");
	cl_git_pass(git_config_get_string(&out, config, "core.editor"));
	cl_assert_equal_s(out, "ed");

	git_config_free(config);

	p_unlink(TEST_CONFIG);
}