diff options
author | Carlos MartÃn Nieto <cmn@dwim.me> | 2016-03-04 14:51:16 +0100 |
---|---|---|
committer | Edward Thomson <ethomson@github.com> | 2016-03-28 10:47:14 -0400 |
commit | 3e95bd36d91cca0f3b1c209cc4f677125c02d442 (patch) | |
tree | 1b2eab44b6af0d7978d23617a8b02beb31d471a6 | |
parent | e89abec69f114a4480431c74160558b86148af41 (diff) | |
download | libgit2-3e95bd36d91cca0f3b1c209cc4f677125c02d442.tar.gz |
config: show we write a spurious duplicated section header
We should notice that we are in the correct section to add. This is a
cosmetic bug, since replacing any of these settings does work.
-rw-r--r-- | tests/config/write.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/config/write.c b/tests/config/write.c index e634aa326..ac0272eac 100644 --- a/tests/config/write.c +++ b/tests/config/write.c @@ -695,3 +695,27 @@ void test_config_write__locking(void) git_config_free(cfg); } + +void test_config_write__repeated(void) +{ + const char *filename = "config-repeated"; + git_config *cfg; + git_buf result; + const char *expected = "[sample \"prefix\"]\n\ +\tsetting1 = someValue1\n\ +\tsetting2 = someValue2\n\ +\tsetting3 = someValue3\n\ +\tsetting4 = someValue4\n\ +"; + cl_git_pass(git_config_open_ondisk(&cfg, filename)); + cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting1", "someValue1")); + cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting2", "someValue2")); + cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting3", "someValue3")); + cl_git_pass(git_config_set_string(cfg, "sample.prefix.setting4", "someValue4")); + + cl_git_pass(git_config_open_ondisk(&cfg, filename)); + + cl_git_pass(git_futils_readbuffer(&result, filename)); + cl_assert_equal_s(expected, result.ptr); + git_buf_free(&result); +} |