~ubuntu-branches/ubuntu/intrepid/git-core/intrepid-updates

« back to all changes in this revision

Viewing changes to t/t4018-diff-funcname.sh

  • Committer: Package Import Robot
  • Author(s): Gerrit Pape
  • Date: 2007-10-04 08:27:01 UTC
  • mfrom: (1.1.23)
  • Revision ID: package-import@ubuntu.com-20071004082701-rsd058ontoqz4i30
Tags: 1:1.5.3.4-1
new upstream point release (closes: #445188).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Copyright (c) 2007 Johannes E. Schindelin
 
4
#
 
5
 
 
6
test_description='Test custom diff function name patterns'
 
7
 
 
8
. ./test-lib.sh
 
9
 
 
10
LF='
 
11
'
 
12
 
 
13
cat > Beer.java << EOF
 
14
public 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
}
 
31
EOF
 
32
 
 
33
sed 's/beer\\/beer,\\/' < Beer.java > Beer-correct.java
 
34
 
 
35
test_expect_success 'default behaviour' '
 
36
        git diff Beer.java Beer-correct.java |
 
37
        grep "^@@.*@@ public class Beer"
 
38
'
 
39
 
 
40
test_expect_success 'preset java pattern' '
 
41
        echo "*.java diff=java" >.gitattributes &&
 
42
        git diff Beer.java Beer-correct.java |
 
43
        grep "^@@.*@@ public static void main("
 
44
'
 
45
 
 
46
git config diff.java.funcname '!static
 
47
!String
 
48
[^      ].*s.*'
 
49
 
 
50
test_expect_success 'custom pattern' '
 
51
        git diff Beer.java Beer-correct.java |
 
52
        grep "^@@.*@@ int special;$"
 
53
'
 
54
 
 
55
test_expect_success 'last regexp must not be negated' '
 
56
        git config diff.java.funcname "!static" &&
 
57
        ! git diff Beer.java Beer-correct.java
 
58
'
 
59
 
 
60
test_done