5 func TestEverything(t *testing.T) {
6 output := GetAllMatches("?? alt/generateStore.php", MatchOptions{})
7 if output[0] != "alt/generateStore.php" {
8 t.Errorf("Doesnt match files", output)
11 output = GetAllMatches("I have a cat.", MatchOptions{})
13 t.Errorf("Matches sentence", output)
16 output = GetAllMatches("/usr/bin/env\\", MatchOptions{})
18 t.Errorf("Doesn't match escaped", output)
20 if output[0] != "/usr/bin/env" {
21 t.Errorf("Doesn't match escaped exactly", output)
24 output = GetAllMatches("!#/usr/bin/env", MatchOptions{})
26 t.Errorf("Doesn't match shebang", output)
28 if output[0] != "/usr/bin/env" {
29 t.Errorf("Doesn't match shebang exactly", output)
32 output = GetAllMatches("hello .gitignore", MatchOptions{})
33 if output[0] != ".gitignore" {
34 t.Errorf("Doesnt match hidden files", output)
37 output = GetAllMatches(" this.user ", MatchOptions{})
39 t.Errorf("Matches this.user", output)
42 output = GetAllMatches(" mail@mail.com ", MatchOptions{})
44 t.Errorf("Matches email adresses", output)
47 output = GetAllMatches(" logo@2x.png ", MatchOptions{})
49 t.Errorf("Doesn't match retina asset", output)
52 output = GetAllMatches("and/or", MatchOptions{})
54 t.Errorf("Matches and/or adresses", output)
57 output = GetAllMatches("v1.2", MatchOptions{})
59 t.Errorf("Matches version number", output)
62 output = GetAllMatches("obj.slice()", MatchOptions{})
64 t.Errorf("Matches function call", output)
67 output = GetAllMatches("fs.read(arg)", MatchOptions{})
69 t.Errorf("Matches function call", output)
72 output = GetAllMatches("~/www", MatchOptions{})
73 if len(output) == 0 || output[0] != "~/www" {
74 t.Errorf("Doesnt match home", output)
77 output = GetAllMatches("origin/master", MatchOptions{})
79 t.Errorf("Matches remote name", output)
82 output = GetAllMatches("john doe (dead on 28/04/2014)", MatchOptions{})
84 t.Errorf("Matches date", output)
87 output = GetAllMatches("john doe ,dead on 28/04/2014", MatchOptions{})
89 t.Errorf("Matches date", output)
92 output = GetAllMatches(".gitignore , ~/www", MatchOptions{})
94 t.Errorf("Doesnt match multi", output)
97 output = GetAllMatches("user.test.js", MatchOptions{})
99 t.Errorf("Doesnt match multiple extensions", output)
102 output = GetAllMatches("(user.js)", MatchOptions{})
103 if len(output) != 1 {
104 t.Errorf("Doesnt match surrounded by parens", output)
106 if output[0] != "user.js" {
107 t.Errorf("matches surrounded by parens badly", output)
110 output = GetAllMatches("var/", MatchOptions{})
111 if len(output) != 1 {
112 t.Errorf("Doesnt match dir", output)
115 output = GetAllMatches("//", MatchOptions{})
116 if len(output) != 0 {
117 t.Errorf("Comment matches", output)
120 output = GetAllMatches("test.js:45", MatchOptions{format: "ackmate"})
121 if len(output) != 1 {
122 t.Errorf("Ackmate doesnt match", output)
124 if output[0] == "test.js" {
125 t.Errorf("Ackmate should not forget number", output)
127 if output[0] != "test.js:45" {
128 t.Errorf("Ackmate should output right line number", output)