path: root/t/
diff options
authorJonathan Nieder <>2011-05-21 19:11:33 (GMT)
committerJunio C Hamano <>2011-05-22 05:29:29 (GMT)
commit5b5e45949bb310fa8972f3e55b9cb05ce8047f37 (patch)
treebd1051a63c719eca89b2f1a5d51654f9ed7e5ba1 /t/
parent9963e025e88f134cf07ef348d80a5821c69a7eb0 (diff)
t4018 (funcname patterns): make .gitattributes state easier to track
Most, but not all, tests in this script rely on attributes declaring that files with a .java extension should use the "java" driver: *.java diff=java Split out a "set up" test to put such a .gitattributes in place after the tests that do not want it have run, to make it more likely that individual tests other than this setup test can be safely modified, rearranged, or skipped. Presumably this setup code will learn to request other drivers for other extensions in the same place when the test suite learns to exercise other diff drivers. Similarly, make sure that early test assertions that do not use these default attributes set up .gitattributes appropriately for themselves, so tests that run before can be modified with less risk of breaking something. Signed-off-by: Jonathan Nieder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 't/')
1 files changed, 6 insertions, 2 deletions
diff --git a/t/ b/t/
index 3646930..24eb1a3 100755
--- a/t/
+++ b/t/
@@ -36,11 +36,12 @@ builtin_patterns="bibtex cpp csharp fortran html java objc pascal perl php pytho
for p in $builtin_patterns
test_expect_success "builtin $p pattern compiles" '
- echo "*.java diff=$p" > .gitattributes &&
+ echo "*.java diff=$p" >.gitattributes &&
! { git diff --no-index 2>&1 |
grep "fatal" > /dev/null; }
test_expect_success "builtin $p wordRegex pattern compiles" '
+ echo "*.java diff=$p" >.gitattributes &&
! { git diff --no-index --word-diff \ 2>&1 |
grep "fatal" > /dev/null; }
@@ -53,8 +54,11 @@ test_expect_success 'default behaviour' '
grep "^@@.*@@ public class Beer"
+test_expect_success 'set up .gitattributes declaring drivers to test' '
+ echo "*.java diff=java" >.gitattributes
test_expect_success 'preset java pattern' '
- echo "*.java diff=java" >.gitattributes &&
git diff --no-index |
grep "^@@.*@@ public static void main("