Commit 0f36271646da455150f821582621f7d0d5e04ddf

Antonio Scandurra 2016-03-31T17:38:40

Add more tests for path matching with globs and path delimiters

diff --git a/tests/attr/ignore.c b/tests/attr/ignore.c
index 91bf984..f11dad5 100644
--- a/tests/attr/ignore.c
+++ b/tests/attr/ignore.c
@@ -132,6 +132,20 @@ void test_attr_ignore__leading_stars(void)
 	assert_is_ignored(false, "dir1/kid2/file");
 }
 
+void test_attr_ignore__globs_and_path_delimiters(void)
+{
+	cl_git_rewritefile("attr/.gitignore", "**/_*/");
+	assert_is_ignored(false, "test_folder/file");
+	assert_is_ignored(true, "_test/file");
+	assert_is_ignored(true, "_test/a/file");
+
+	cl_git_rewritefile("attr/.gitignore", "**/_*/foo/bar/*ux");
+
+	assert_is_ignored(true, "_test/foo/bar/qux/file");
+	assert_is_ignored(true, "_test/foo/bar/crux/file");
+	assert_is_ignored(false, "_test/foo/bar/code/file");
+}
+
 void test_attr_ignore__skip_gitignore_directory(void)
 {
 	cl_git_rewritefile("attr/.git/info/exclude", "/NewFolder\n/NewFolder/NewFolder");