]> Sergey Matveev's repositories - path-extractor.git/blob - pe_test.go
378e79ac31a6950aee1c52e1acc5e75505fcc242
[path-extractor.git] / pe_test.go
1 package main
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("v1.2")
22     if len(output) != 0 {
23         t.Errorf("Matches version number", output[0])
24     }
25
26     output=getAllMatches("obj.slice()")
27     if len(output) != 0 {
28         t.Errorf("Matches function call", output[0])
29     }
30
31     output=getAllMatches("~/www")
32     if len(output) == 0 || output[0] != "~/www" {
33         t.Errorf("Doesnt match home", output[0])
34     }
35
36     output=getAllMatches("origin/master")
37     if len(output) != 0 {
38         t.Errorf("Matches remote name", output[0])
39     }
40
41     output=getAllMatches("john doe (dead on 28/04/2014)")
42     if len(output) != 0 {
43         t.Errorf("Matches date", output[0])
44     }
45
46     output=getAllMatches("john doe ,dead on 28/04/2014")
47     if len(output) != 0 {
48         t.Errorf("Matches date", output[0])
49     }
50
51     output=getAllMatches(".gitignore , ~/www")
52     if len(output) != 2 {
53         t.Errorf("Doesnt match multi", output[0])
54     }
55
56     output=getAllMatches("var/")
57     if len(output) != 1 {
58         t.Errorf("Doesnt match dir", output[0])
59     }
60
61     output=getAllMatches("//")
62     if len(output) != 0 {
63         t.Errorf("Comment matches", output[0])
64     }
65 }