5 func TestEverything(t *testing.T) {
6 output := GetAllMatches("?? alt/generateStore.php", "")
7 if output[0] != "alt/generateStore.php" {
8 t.Errorf("Doesnt match files", output)
11 output = GetAllMatches("I have a cat.", "")
13 t.Errorf("Matches sentence", output)
16 output = GetAllMatches("'/usr/bin", "")
17 if output[0] != "/usr/bin" {
18 t.Errorf("Doesn't match statement correctly", output)
21 output = GetAllMatches("/usr_b/bin", "")
22 if output[0] != "/usr_b/bin" {
23 t.Errorf("Doesn't match statement correctly", output)
26 output = GetAllMatches("\"/usr/bin", "")
27 if output[0] != "/usr/bin" {
28 t.Errorf("Doesn't match statement correctly", output)
31 output = GetAllMatches("`/usr/bin", "")
32 if output[0] != "/usr/bin" {
33 t.Errorf("Doesn't match statement correctly", output)
36 output = GetAllMatches("€/usr/bin", "")
37 if output[0] != "/usr/bin" {
38 t.Errorf("Doesn't match statement correctly", output)
41 output = GetAllMatches("prefix=/usr/bin", "")
43 t.Errorf("Should match =/usr/bin", output)
45 if output[0] != "/usr/bin" {
46 t.Errorf("Doesn't match statement correctly", output)
49 output = GetAllMatches("/var//log", "")
51 t.Errorf("Matches double //", output)
54 output = GetAllMatches("s/+//", "")
56 t.Errorf("Doesn't match substitute", output)
59 output = GetAllMatches("s/^//", "")
61 t.Errorf("Doesn't match substitute", output)
64 output = GetAllMatches("/usr/bin/env\\", "")
66 t.Errorf("Doesn't match escaped", output)
68 if output[0] != "/usr/bin/env" {
69 t.Errorf("Doesn't match escaped exactly", output)
72 output = GetAllMatches("!#/usr/bin/env", "")
74 t.Errorf("Doesn't match shebang", output)
76 if output[0] != "/usr/bin/env" {
77 t.Errorf("Doesn't match shebang exactly", output)
80 output = GetAllMatches("hello .gitignore", "")
81 if output[0] != ".gitignore" {
82 t.Errorf("Doesnt match hidden files", output)
85 output = GetAllMatches(" this.user ", "")
87 t.Errorf("Matches this.user", output)
90 output = GetAllMatches("To https://test@test.org/88/ls.git", "")
92 t.Errorf("Matches email adresses", output)
95 output = GetAllMatches(" mail@mail.com ", "")
97 t.Errorf("Matches email adresses", output)
100 output = GetAllMatches(" logo@2x.png ", "")
101 if len(output) == 0 {
102 t.Errorf("Doesn't match retina asset", output)
105 output = GetAllMatches("and/or", "")
106 if len(output) != 0 {
107 t.Errorf("Matches and/or adresses", output)
110 output = GetAllMatches("v1.2", "")
111 if len(output) != 0 {
112 t.Errorf("Matches version number", output)
115 output = GetAllMatches("~/v1.2/js", "")
116 if len(output) != 1 {
117 t.Errorf("Should match path with version inside", output)
120 output = GetAllMatches("obj.slice()", "")
121 if len(output) != 0 {
122 t.Errorf("Matches function call", output)
125 output = GetAllMatches("fs.read(arg)", "")
126 if len(output) != 0 {
127 t.Errorf("Matches function call", output)
130 output = GetAllMatches("~/www", "")
131 if len(output) == 0 || output[0] != "~/www" {
132 t.Errorf("Doesnt match home", output)
135 output = GetAllMatches("origin/master", "")
136 if len(output) != 0 {
137 t.Errorf("Matches remote name", output)
140 output = GetAllMatches("john doe (dead on 28/04/2014)", "")
141 if len(output) != 0 {
142 t.Errorf("Matches date", output)
145 output = GetAllMatches("john doe ,dead on 28/04/2014", "")
146 if len(output) != 0 {
147 t.Errorf("Matches date", output)
150 output = GetAllMatches(".gitignore , ~/www", "")
151 if len(output) != 2 {
152 t.Errorf("Doesnt match multi", output)
155 output = GetAllMatches("user.test.js", "")
156 if len(output) != 1 {
157 t.Errorf("Doesnt match multiple extensions", output)
160 output = GetAllMatches("(user.js)", "")
161 if len(output) != 1 {
162 t.Errorf("Doesnt match surrounded by parens", output)
164 if output[0] != "user.js" {
165 t.Errorf("matches surrounded by parens badly", output)
168 output = GetAllMatches("var/", "")
169 if len(output) != 1 {
170 t.Errorf("Doesnt match dir", output)
173 output = GetAllMatches("//", "")
174 if len(output) != 0 {
175 t.Errorf("Comment matches", output)
178 output = GetAllMatches("test.js:45", "ackmate")
179 if len(output) != 1 {
180 t.Errorf("Ackmate doesnt match", output)
183 if output[0] == "test.js" {
184 t.Errorf("Ackmate should not forget number", output)
186 if output[0] != "test.js:45" {
187 t.Errorf("Ackmate should output right line number", output)
190 output = GetAllMatches("test.js:45:12", "ackmate")
191 if len(output) != 1 {
192 t.Errorf("Ackmate doesnt match", output)
195 if output[0] == "test.js" {
196 t.Errorf("Ackmate should not forget number", output)
198 if output[0] != "test.js:45:12" {
199 t.Errorf("Ackmate should output right line number", output)
202 output = GetAllMatches("test.js:45:12 foo bar", "ackmate")
203 if len(output) != 1 {
204 t.Errorf("Ackmate doesnt match", output)
207 if output[0] == "test.js" {
208 t.Errorf("Ackmate should not forget number", output)
210 if output[0] != "test.js:45:12" {
211 t.Errorf("Ackmate should output right line number", output)