diff options
| author | Russell Belfer <rb@github.com> | 2012-10-23 09:53:15 -0700 |
|---|---|---|
| committer | Russell Belfer <rb@github.com> | 2012-10-23 09:53:15 -0700 |
| commit | 5b67d145d8f465ed0c7ed9c07d331aae29c2713b (patch) | |
| tree | 17de8c31afbdb3398a391e1fcede5010394dec85 /tests-clar/config/stress.c | |
| parent | 8a89aa1f57fc0b352800bc77e228554fe95caddd (diff) | |
| parent | a1abe66aca3625eec1cabb2e93cf8df0be1b63f0 (diff) | |
| download | libgit2-5b67d145d8f465ed0c7ed9c07d331aae29c2713b.tar.gz | |
Merge pull request #923 from yorah/topic/config-store
Add git_config_level support when handling config files
Diffstat (limited to 'tests-clar/config/stress.c')
| -rw-r--r-- | tests-clar/config/stress.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/tests-clar/config/stress.c b/tests-clar/config/stress.c index 6e7db6e8f..317e877f7 100644 --- a/tests-clar/config/stress.c +++ b/tests-clar/config/stress.c @@ -4,11 +4,13 @@ #include "fileops.h" #include "posix.h" +#define TEST_CONFIG "git-test-config" + void test_config_stress__initialize(void) { git_filebuf file = GIT_FILEBUF_INIT; - cl_git_pass(git_filebuf_open(&file, "git-test-config", 0)); + cl_git_pass(git_filebuf_open(&file, TEST_CONFIG, 0)); git_filebuf_printf(&file, "[color]\n\tui = auto\n"); git_filebuf_printf(&file, "[core]\n\teditor = \n"); @@ -18,19 +20,16 @@ void test_config_stress__initialize(void) void test_config_stress__cleanup(void) { - p_unlink("git-test-config"); + p_unlink(TEST_CONFIG); } void test_config_stress__dont_break_on_invalid_input(void) { const char *editor, *color; - struct git_config_file *file; git_config *config; - cl_assert(git_path_exists("git-test-config")); - cl_git_pass(git_config_file__ondisk(&file, "git-test-config")); - cl_git_pass(git_config_new(&config)); - cl_git_pass(git_config_add_file(config, file, 0)); + cl_assert(git_path_exists(TEST_CONFIG)); + cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG)); cl_git_pass(git_config_get_string(&color, config, "color.ui")); cl_git_pass(git_config_get_string(&editor, config, "core.editor")); @@ -40,13 +39,10 @@ void test_config_stress__dont_break_on_invalid_input(void) void test_config_stress__comments(void) { - struct git_config_file *file; git_config *config; const char *str; - cl_git_pass(git_config_file__ondisk(&file, cl_fixture("config/config12"))); - cl_git_pass(git_config_new(&config)); - cl_git_pass(git_config_add_file(config, file, 0)); + cl_git_pass(git_config_open_ondisk(&config, cl_fixture("config/config12"))); cl_git_pass(git_config_get_string(&str, config, "some.section.other")); cl_assert(!strcmp(str, "hello! \" ; ; ; ")); @@ -62,21 +58,16 @@ void test_config_stress__comments(void) void test_config_stress__escape_subsection_names(void) { - struct git_config_file *file; git_config *config; const char *str; cl_assert(git_path_exists("git-test-config")); - cl_git_pass(git_config_file__ondisk(&file, "git-test-config")); - cl_git_pass(git_config_new(&config)); - cl_git_pass(git_config_add_file(config, file, 0)); + cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG)); cl_git_pass(git_config_set_string(config, "some.sec\\tion.other", "foo")); git_config_free(config); - cl_git_pass(git_config_file__ondisk(&file, "git-test-config")); - cl_git_pass(git_config_new(&config)); - cl_git_pass(git_config_add_file(config, file, 0)); + cl_git_pass(git_config_open_ondisk(&config, TEST_CONFIG)); cl_git_pass(git_config_get_string(&str, config, "some.sec\\tion.other")); cl_assert(!strcmp("foo", str)); |
