]> Sergey Matveev's repositories - path-extractor.git/blob - pe_test.go
c10655aac70d99aa3af10813c3c04dea01475914
[path-extractor.git] / pe_test.go
1 package pathextractor
2
3 import "testing"
4
5 func TestGitIgnore(t *testing.T) {
6         output := GetAllMatches("?? alt/generateStore.php")
7         if output[0] != "alt/generateStore.php" {
8                 t.Errorf("Doesnt match files", output[0])
9         }
10
11         output = GetAllMatches("hello .gitignore")
12         if output[0] != ".gitignore" {
13                 t.Errorf("Doesnt match hidden files", output[0])
14         }
15
16         output = GetAllMatches(" mail@mail.com ")
17         if len(output) != 0 {
18                 t.Errorf("Matches email adresses", output[0])
19         }
20
21         output = GetAllMatches(" logo@2x.png ")
22         if len(output) == 0 {
23                 t.Errorf("Doesn't match retina asset", output[0])
24         }
25
26         output = GetAllMatches("and/or")
27         if len(output) != 0 {
28                 t.Errorf("Matches and/or adresses", output[0])
29         }
30
31         output = GetAllMatches("v1.2")
32         if len(output) != 0 {
33                 t.Errorf("Matches version number", output[0])
34         }
35
36         output = GetAllMatches("obj.slice()")
37         if len(output) != 0 {
38                 t.Errorf("Matches function call", output[0])
39         }
40
41         output = GetAllMatches("~/www")
42         if len(output) == 0 || output[0] != "~/www" {
43                 t.Errorf("Doesnt match home", output[0])
44         }
45
46         output = GetAllMatches("origin/master")
47         if len(output) != 0 {
48                 t.Errorf("Matches remote name", output[0])
49         }
50
51         output = GetAllMatches("john doe (dead on 28/04/2014)")
52         if len(output) != 0 {
53                 t.Errorf("Matches date", output[0])
54         }
55
56         output = GetAllMatches("john doe ,dead on 28/04/2014")
57         if len(output) != 0 {
58                 t.Errorf("Matches date", output[0])
59         }
60
61         output = GetAllMatches(".gitignore , ~/www")
62         if len(output) != 2 {
63                 t.Errorf("Doesnt match multi", output[0])
64         }
65
66         output = GetAllMatches("var/")
67         if len(output) != 1 {
68                 t.Errorf("Doesnt match dir", output[0])
69         }
70
71         output = GetAllMatches("//")
72         if len(output) != 0 {
73                 t.Errorf("Comment matches", output[0])
74         }
75 }