Skip to content

Commit 5b5e459

Browse files
jrngitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 9963e02 commit 5b5e459

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

t/t4018-diff-funcname.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ builtin_patterns="bibtex cpp csharp fortran html java objc pascal perl php pytho
3636
for p in $builtin_patterns
3737
do
3838
test_expect_success "builtin $p pattern compiles" '
39-
echo "*.java diff=$p" > .gitattributes &&
39+
echo "*.java diff=$p" >.gitattributes &&
4040
! { git diff --no-index Beer.java Beer-correct.java 2>&1 |
4141
grep "fatal" > /dev/null; }
4242
'
4343
test_expect_success "builtin $p wordRegex pattern compiles" '
44+
echo "*.java diff=$p" >.gitattributes &&
4445
! { git diff --no-index --word-diff \
4546
Beer.java Beer-correct.java 2>&1 |
4647
grep "fatal" > /dev/null; }
@@ -53,8 +54,11 @@ test_expect_success 'default behaviour' '
5354
grep "^@@.*@@ public class Beer"
5455
'
5556

57+
test_expect_success 'set up .gitattributes declaring drivers to test' '
58+
echo "*.java diff=java" >.gitattributes
59+
'
60+
5661
test_expect_success 'preset java pattern' '
57-
echo "*.java diff=java" >.gitattributes &&
5862
git diff --no-index Beer.java Beer-correct.java |
5963
grep "^@@.*@@ public static void main("
6064
'

0 commit comments

Comments
 (0)