Docs: send-email: Man page option ordering
[git/jnareb-git.git] / t / t4018-diff-funcname.sh
blob520e095c597a61f0f263a274a53ae0aa2781da85
1 #!/bin/sh
3 # Copyright (c) 2007 Johannes E. Schindelin
6 test_description='Test custom diff function name patterns'
8 . ./test-lib.sh
10 LF='
13 cat > Beer.java << EOF
14 public class Beer
16 int special;
17 public static void main(String args[])
19 String s=" ";
20 for(int x = 99; x > 0; x--)
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");
27 System.out.print("Go to the store, buy some more,\n"
28 + "99 bottles of beer on the wall.\n");
31 EOF
33 sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
35 builtin_patterns="bibtex html java pascal php python ruby tex"
36 for p in $builtin_patterns
38 test_expect_success "builtin $p pattern compiles" '
39 echo "*.java diff=$p" > .gitattributes &&
40 ! ( git diff --no-index Beer.java Beer-correct.java 2>&1 |
41 grep "fatal" > /dev/null )
43 done
45 test_expect_success 'default behaviour' '
46 rm -f .gitattributes &&
47 git diff --no-index Beer.java Beer-correct.java |
48 grep "^@@.*@@ public class Beer"
51 test_expect_success 'preset java pattern' '
52 echo "*.java diff=java" >.gitattributes &&
53 git diff --no-index Beer.java Beer-correct.java |
54 grep "^@@.*@@ public static void main("
57 git config diff.java.funcname '!static
58 !String
59 [^ ].*s.*'
61 test_expect_success 'custom pattern' '
62 git diff --no-index Beer.java Beer-correct.java |
63 grep "^@@.*@@ int special;$"
66 test_expect_success 'last regexp must not be negated' '
67 git config diff.java.funcname "!static" &&
68 test_must_fail git diff --no-index Beer.java Beer-correct.java
71 test_expect_success 'alternation in pattern' '
72 git config diff.java.xfuncname "^[ ]*((public|static).*)$" &&
73 git diff --no-index Beer.java Beer-correct.java |
74 grep "^@@.*@@ public static void main("
77 test_done