diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2013-04-20 17:25:39 +0400 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2013-04-20 19:54:12 +0400 |
commit | e5a27f039ee3ae1291fd5084707c3f9c168f10ba (patch) | |
tree | e54682c97ebb32f2f48445e2488d08316aa7fd2b /tests-clar/config | |
parent | 8f24e65ff6f7573bc6778f5bbea7119fc9b7b626 (diff) |
config: allow setting multivars when none exist yet
Adding a multivar when there are no variables with that name set
should set the variable instead of failing.
Diffstat (limited to 'tests-clar/config')
-rw-r--r-- | tests-clar/config/multivar.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/tests-clar/config/multivar.c b/tests-clar/config/multivar.c index 26537e20a..0bda6bcec 100644 --- a/tests-clar/config/multivar.c +++ b/tests-clar/config/multivar.c @@ -97,6 +97,22 @@ void test_config_multivar__add(void) git_config_free(cfg); } +void test_config_multivar__add_new(void) +{ + const char *var = "a.brand.new"; + git_config *cfg; + int n; + + cl_git_pass(git_config_open_ondisk(&cfg, "config/config11")); + + cl_git_pass(git_config_set_multivar(cfg, var, "", "variable")); + n = 0; + cl_git_pass(git_config_get_multivar(cfg, var, NULL, cb, &n)); + cl_assert(n == 1); + + git_config_free(cfg); +} + void test_config_multivar__replace(void) { git_config *cfg; |