Make test scripts executable.
[git/git.git] / t / t4018-diff-funcname.sh
CommitLineData
f258475a
JH
1#!/bin/sh
2#
3# Copyright (c) 2007 Johannes E. Schindelin
4#
5
6test_description='Test custom diff function name patterns'
7
8. ./test-lib.sh
9
10LF='
11'
12
13cat > Beer.java << EOF
14public class Beer
15{
16 int special;
17 public static void main(String args[])
18 {
19 String s=" ";
20 for(int x = 99; x > 0; x--)
21 {
22 System.out.print(x + " bottles of beer on the wall "
23 + x + " bottles of beer\n"
24 + "Take one down, pass it around, " + (x - 1)
25 + " bottles of beer on the wall.\n");
26 }
27 System.out.print("Go to the store, buy some more,\n"
28 + "99 bottles of beer on the wall.\n");
29 }
30}
31EOF
32
33sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
34
35test_expect_success 'default behaviour' '
36 git diff Beer.java Beer-correct.java |
37 grep "^@@.*@@ public class Beer"
38'
39
40test_expect_success 'preset java pattern' '
e0e324a4 41 echo "*.java diff=java" >.gitattributes &&
f258475a
JH
42 git diff Beer.java Beer-correct.java |
43 grep "^@@.*@@ public static void main("
44'
45
e0e324a4 46git config diff.java.funcname '!static
f258475a
JH
47!String
48[^ ].*s.*'
49
50test_expect_success 'custom pattern' '
51 git diff Beer.java Beer-correct.java |
52 grep "^@@.*@@ int special;$"
53'
54
55test_expect_success 'last regexp must not be negated' '
e0e324a4 56 git config diff.java.funcname "!static" &&
f258475a
JH
57 ! git diff Beer.java Beer-correct.java
58'
59
60test_done