Add test for possible attr bug This is a test that should replicate an issue that Peff is setting with git attributes. But the test doesn't fail.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
diff --git a/tests-clar/attr/repo.c b/tests-clar/attr/repo.c
index 7224315..9f6a49b 100644
--- a/tests-clar/attr/repo.c
+++ b/tests-clar/attr/repo.c
@@ -29,8 +29,6 @@ void test_attr_repo__cleanup(void)
void test_attr_repo__get_one(void)
{
- const char *value;
-
struct attr_expected test_cases[] = {
{ "root_test1", "repoattr", EXPECT_TRUE, NULL },
{ "root_test1", "rootattr", EXPECT_TRUE, NULL },
@@ -63,6 +61,8 @@ void test_attr_repo__get_one(void)
{ "sub/sub/subdir.txt", "reposub", EXPECT_UNDEFINED, NULL },
{ "does-not-exist", "foo", EXPECT_STRING, "yes" },
{ "sub/deep/file", "deepdeep", EXPECT_TRUE, NULL },
+ { "sub/sub/d/no", "test", EXPECT_STRING, "a/b/d/*" },
+ { "sub/sub/d/yes", "test", EXPECT_UNDEFINED, NULL },
{ NULL, NULL, 0, NULL }
}, *scan;
@@ -224,3 +224,4 @@ void test_attr_repo__bad_macros(void)
cl_assert_strequal("hahaha", values[4]);
cl_assert(GIT_ATTR_TRUE(values[5]));
}
+
diff --git a/tests/resources/attr/gitattributes b/tests/resources/attr/gitattributes
index c0c2a56..e038983 100644
--- a/tests/resources/attr/gitattributes
+++ b/tests/resources/attr/gitattributes
@@ -23,3 +23,7 @@ macro* macro2 macro2 macro2
[attr]thirdmacro secondmacro=hahaha
macro_bad firstmacro secondmacro thirdmacro
+
+# another test that Peff found was failing
+[attr]notest !test
+
diff --git a/tests/resources/attr/sub/sub/.gitattributes b/tests/resources/attr/sub/sub/.gitattributes
new file mode 100644
index 0000000..55225e4
--- /dev/null
+++ b/tests/resources/attr/sub/sub/.gitattributes
@@ -0,0 +1,3 @@
+d/* test=a/b/d/*
+d/yes notest
+