mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-05 18:33:28 +00:00
tests: add multivar read test
This commit is contained in:
parent
0774d94d31
commit
78d65f390f
24
tests-clar/config/multivar.c
Normal file
24
tests-clar/config/multivar.c
Normal file
@ -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);
|
||||
}
|
BIN
tests/resources/config/config11
Normal file
BIN
tests/resources/config/config11
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user