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("2.0G", "")
13 t.Errorf("File size matches", output)
16 output = GetAllMatches("4.0K", "")
18 t.Errorf("File size matches", output)
21 output = GetAllMatches("72K", "")
23 t.Errorf("File size matches", output)
26 output = GetAllMatches("remotes/origin/master", "")
28 t.Errorf("Git branch matches", output)
31 output = GetAllMatches("I have a cat.", "")
33 t.Errorf("Matches sentence", output)
36 output = GetAllMatches("'/usr/bin", "")
37 if output[0] != "/usr/bin" {
38 t.Errorf("Doesn't match statement correctly", output)
41 output = GetAllMatches("/usr_b/bin", "")
42 if output[0] != "/usr_b/bin" {
43 t.Errorf("Doesn't match statement correctly", output)
46 output = GetAllMatches("\"/usr/bin", "")
47 if output[0] != "/usr/bin" {
48 t.Errorf("Doesn't match statement correctly", output)
51 output = GetAllMatches("`/usr/bin", "")
52 if output[0] != "/usr/bin" {
53 t.Errorf("Doesn't match statement correctly", output)
56 output = GetAllMatches("€/usr/bin", "")
57 if output[0] != "/usr/bin" {
58 t.Errorf("Doesn't match statement correctly", output)
61 output = GetAllMatches("prefix=/usr/bin", "")
63 t.Errorf("Should match =/usr/bin", output)
65 if output[0] != "/usr/bin" {
66 t.Errorf("Doesn't match statement correctly", output)
69 output = GetAllMatches("/var//log", "")
71 t.Errorf("Matches double //", output)
74 output = GetAllMatches("s/+//", "")
76 t.Errorf("Doesn't match substitute", output)
79 output = GetAllMatches("s/^//", "")
81 t.Errorf("Doesn't match substitute", output)
84 output = GetAllMatches("/usr/bin/env\\", "")
86 t.Errorf("Doesn't match escaped", output)
88 if output[0] != "/usr/bin/env" {
89 t.Errorf("Doesn't match escaped exactly", output)
92 output = GetAllMatches("!#/usr/bin/env", "")
94 t.Errorf("Doesn't match shebang", output)
96 if output[0] != "/usr/bin/env" {
97 t.Errorf("Doesn't match shebang exactly", output)
100 output = GetAllMatches("hello .gitignore", "")
101 if output[0] != ".gitignore" {
102 t.Errorf("Doesnt match hidden files", output)
105 output = GetAllMatches(" this.user ", "")
106 if len(output) != 0 {
107 t.Errorf("Matches this.user", output)
110 output = GetAllMatches("To https://test@test.org/88/ls.git", "")
111 if len(output) != 0 {
112 t.Errorf("Matches email adresses", output)
115 output = GetAllMatches(" mail@mail.com ", "")
116 if len(output) != 0 {
117 t.Errorf("Matches email adresses", output)
120 output = GetAllMatches(" logo@2x.png ", "")
121 if len(output) == 0 {
122 t.Errorf("Doesn't match retina asset", output)
125 output = GetAllMatches("and/or", "")
126 if len(output) != 0 {
127 t.Errorf("Matches and/or adresses", output)
130 output = GetAllMatches("v1.2", "")
131 if len(output) != 0 {
132 t.Errorf("Matches version number", output)
135 output = GetAllMatches("~/v1.2/js", "")
136 if len(output) != 1 {
137 t.Errorf("Should match path with version inside", output)
140 output = GetAllMatches("obj.slice()", "")
141 if len(output) != 0 {
142 t.Errorf("Matches function call", output)
145 output = GetAllMatches("fs.read(arg)", "")
146 if len(output) != 0 {
147 t.Errorf("Matches function call", output)
150 output = GetAllMatches("~/www", "")
151 if len(output) == 0 || output[0] != "~/www" {
152 t.Errorf("Doesnt match home", output)
155 output = GetAllMatches("origin/master", "")
156 if len(output) != 0 {
157 t.Errorf("Matches remote name", output)
160 output = GetAllMatches("john doe (dead on 28/04/2014)", "")
161 if len(output) != 0 {
162 t.Errorf("Matches date", output)
165 output = GetAllMatches("john doe ,dead on 28/04/2014", "")
166 if len(output) != 0 {
167 t.Errorf("Matches date", output)
170 output = GetAllMatches(".gitignore , ~/www", "")
171 if len(output) != 2 {
172 t.Errorf("Doesnt match multi", output)
175 output = GetAllMatches("user.test.js", "")
176 if len(output) != 1 {
177 t.Errorf("Doesnt match multiple extensions", output)
180 output = GetAllMatches("[Error/foobar]", "")
181 if len(output) == 1 {
182 t.Errorf("Matches error", output)
185 output = GetAllMatches("[Object.foo]", "")
186 if len(output) == 1 {
187 t.Errorf("Matches Object.foo", output)
190 output = GetAllMatches("(user.js)", "")
191 if len(output) != 1 {
192 t.Errorf("Doesnt match surrounded by parens", output)
194 if output[0] != "user.js" {
195 t.Errorf("matches surrounded by parens badly", output)
198 output = GetAllMatches("var/", "")
199 if len(output) != 1 {
200 t.Errorf("Doesnt match dir", output)
203 output = GetAllMatches("//", "")
204 if len(output) != 0 {
205 t.Errorf("Comment matches", output)
208 output = GetAllMatches("test.js:45", "ackmate")
209 if len(output) != 1 {
210 t.Errorf("Ackmate doesnt match", output)
213 if output[0] == "test.js" {
214 t.Errorf("Ackmate should not forget number", output)
216 if output[0] != "test.js:45" {
217 t.Errorf("Ackmate should output right line number", output)
220 output = GetAllMatches("test.js:45:12", "ackmate")
221 if len(output) != 1 {
222 t.Errorf("Ackmate doesnt match", output)
225 if output[0] == "test.js" {
226 t.Errorf("Ackmate should not forget number", output)
228 if output[0] != "test.js:45:12" {
229 t.Errorf("Ackmate should output right line number", output)
232 output = GetAllMatches("test.js:45:12 foo bar", "ackmate")
233 if len(output) != 1 {
234 t.Errorf("Ackmate doesnt match", output)
237 if output[0] == "test.js" {
238 t.Errorf("Ackmate should not forget number", output)
240 if output[0] != "test.js:45:12" {
241 t.Errorf("Ackmate should output right line number", output)