diff options
-rw-r--r-- | tests-clar/config/multivar.c | 24 | ||||
-rw-r--r-- | tests/resources/config/config11 | 3 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests-clar/config/multivar.c b/tests-clar/config/multivar.c new file mode 100644 index 000000000..dbb7c8af9 --- /dev/null +++ b/tests-clar/config/multivar.c @@ -0,0 +1,24 @@ +#include "clar_libgit2.h" + +static int mv_read_cb(const char *name, const char *GIT_UNUSED(value), void *data) +{ + int *n = (int *) data; + + if (!strcmp(name, "remote.fancy.fetch")) + (*n)++; + + return 0; +} + +void test_config_multivar__foreach(void) +{ + git_config *cfg; + int n = 0; + + cl_git_pass(git_config_open_ondisk(&cfg, cl_fixture("config/config11"))); + + cl_git_pass(git_config_foreach(cfg, mv_read_cb, &n)); + cl_assert(n == 2); + + git_config_free(cfg); +} diff --git a/tests/resources/config/config11 b/tests/resources/config/config11 new file mode 100644 index 000000000..bda653bbe --- /dev/null +++ b/tests/resources/config/config11 @@ -0,0 +1,3 @@ +[remote "fancy"] + fetch = git://github.com/libgit2/libgit2 + fetch = git://git.example.com/libgit2 |