diff options
| author | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-03-09 20:38:32 +0100 |
|---|---|---|
| committer | Carlos Martín Nieto <carlos@cmartin.tk> | 2012-03-09 20:43:17 +0100 |
| commit | 54fef6ebcba8777caf389cba06556aab6f22b1cc (patch) | |
| tree | 9924808b98aa668158b5085a1995994285cf5405 /tests-clar/config/write.c | |
| parent | 6cfe3b3f12a059a044f94c63e495ab729cd9ec7b (diff) | |
| download | libgit2-54fef6ebcba8777caf389cba06556aab6f22b1cc.tar.gz | |
config: write out section headers with subsections correctly
write_section() mistakenly treated is input as the whole variable name
instead of simply the section (and possibly subsection) and would
confuse "section.subsection" as a section plus variable name and
produce a wrong section header.
Fix this and include a test for writing "section.subsection.var" and
reading it from the file.
Diffstat (limited to 'tests-clar/config/write.c')
| -rw-r--r-- | tests-clar/config/write.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests-clar/config/write.c b/tests-clar/config/write.c index d22c6f2cf..f25bf5a91 100644 --- a/tests-clar/config/write.c +++ b/tests-clar/config/write.c @@ -67,6 +67,21 @@ void test_config_write__delete_value(void) git_config_free(cfg); } +void test_config_write__write_subsection(void) +{ + git_config *cfg; + const char *str; + + cl_git_pass(git_config_open_ondisk(&cfg, "config9")); + cl_git_pass(git_config_set_string(cfg, "my.own.var", "works")); + git_config_free(cfg); + + cl_git_pass(git_config_open_ondisk(&cfg, "config9")); + cl_git_pass(git_config_get_string(cfg, "my.own.var", &str)); + cl_git_pass(strcmp(str, "works")); + git_config_free(cfg); +} + void test_config_write__delete_inexistent(void) { git_config *cfg; |
