]>
git.proxmox.com Git - libgit2.git/blob - tests/clar/fixtures.h
2 fixture_path(const char *base
, const char *fixture_name
)
4 static char _path
[4096];
7 root_len
= strlen(base
);
8 strncpy(_path
, base
, sizeof(_path
));
10 if (_path
[root_len
- 1] != '/')
11 _path
[root_len
++] = '/';
13 if (fixture_name
[0] == '/')
16 strncpy(_path
+ root_len
,
18 sizeof(_path
) - root_len
);
23 #ifdef CLAR_FIXTURE_PATH
24 const char *cl_fixture(const char *fixture_name
)
26 return fixture_path(CLAR_FIXTURE_PATH
, fixture_name
);
29 void cl_fixture_sandbox(const char *fixture_name
)
31 fs_copy(cl_fixture(fixture_name
), _clar_path
);
34 const char *cl_fixture_basename(const char *fixture_name
)
38 for (p
= fixture_name
; *p
; p
++) {
39 if (p
[0] == '/' && p
[1] && p
[1] != '/')
46 void cl_fixture_cleanup(const char *fixture_name
)
48 fs_rm(fixture_path(_clar_path
, cl_fixture_basename(fixture_name
)));