mirror of
https://git.proxmox.com/git/libgit2
synced 2025-11-01 13:47:36 +00:00
ignore: enhance git_ignore_path_is_ignored() test coverage
This commit is contained in:
parent
0309e85045
commit
d788499a10
32
tests-clar/attr/ignore.c
Normal file
32
tests-clar/attr/ignore.c
Normal file
@ -0,0 +1,32 @@
|
||||
#include "clar_libgit2.h"
|
||||
|
||||
static git_repository *g_repo = NULL;
|
||||
|
||||
void test_attr_ignore__initialize(void)
|
||||
{
|
||||
g_repo = cl_git_sandbox_init("attr");
|
||||
}
|
||||
|
||||
void test_attr_ignore__cleanup(void)
|
||||
{
|
||||
cl_git_sandbox_cleanup();
|
||||
g_repo = NULL;
|
||||
}
|
||||
|
||||
void assert_is_ignored(bool expected, const char *filepath)
|
||||
{
|
||||
int is_ignored;
|
||||
|
||||
cl_git_pass(git_ignore_path_is_ignored(&is_ignored, g_repo, filepath));
|
||||
cl_assert_equal_i(expected, is_ignored == 1);
|
||||
}
|
||||
|
||||
void test_attr_ignore__honor_temporary_rules(void)
|
||||
{
|
||||
cl_git_rewritefile("attr/.gitignore", "/NewFolder\n/NewFolder/NewFolder");
|
||||
|
||||
assert_is_ignored(false, "File.txt");
|
||||
assert_is_ignored(true, "NewFolder");
|
||||
assert_is_ignored(true, "NewFolder/NewFolder");
|
||||
assert_is_ignored(true, "NewFolder/NewFolder/File.txt");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user