@@ -86,7 +86,7 @@ function TestCO:testGlobalPattern() -- luacheck: ignore 212
86
86
return lines [i ]
87
87
end
88
88
end
89
-
89
+
90
90
local result = CO .matchFilesToCodeowner ({" README.md" , " src/main.js" })
91
91
lu .assertEquals (result , {" @global-owner1" , " @global-owner2" })
92
92
end
@@ -101,7 +101,7 @@ function TestCO:testJavaScriptPattern() -- luacheck: ignore 212
101
101
return lines [i ]
102
102
end
103
103
end
104
-
104
+
105
105
local result = CO .matchFilesToCodeowner ({" app.js" , " utils.js" })
106
106
lu .assertEquals (result , {" @js-owner" })
107
107
end
@@ -116,7 +116,7 @@ function TestCO:testGoPattern() -- luacheck: ignore 212
116
116
return lines [i ]
117
117
end
118
118
end
119
-
119
+
120
120
local result = CO .matchFilesToCodeowner ({" main.go" , " server.go" })
121
121
lu .assertEquals (result , {" docs@example.com" })
122
122
end
@@ -131,7 +131,7 @@ function TestCO:testTxtPattern() -- luacheck: ignore 212
131
131
return lines [i ]
132
132
end
133
133
end
134
-
134
+
135
135
local result = CO .matchFilesToCodeowner ({" README.txt" , " notes.txt" })
136
136
lu .assertEquals (result , {" @octo-org/octocats" })
137
137
end
@@ -146,7 +146,7 @@ function TestCO:testBuildLogsDirectoryPattern() -- luacheck: ignore 212
146
146
return lines [i ]
147
147
end
148
148
end
149
-
149
+
150
150
local result = CO .matchFilesToCodeowner ({" /build/logs/app.log" , " /build/logs/error.log" })
151
151
lu .assertEquals (result , {" @doctocat" })
152
152
end
@@ -161,7 +161,7 @@ function TestCO:testDocsWildcardPattern() -- luacheck: ignore 212
161
161
return lines [i ]
162
162
end
163
163
end
164
-
164
+
165
165
local result = CO .matchFilesToCodeowner ({" docs/README.md" , " docs/guide.txt" })
166
166
lu .assertEquals (result , {" docs@example.com" })
167
167
end
@@ -176,7 +176,7 @@ function TestCO:testDocsWildcardDoesNotMatchSubdirectories() -- luacheck: ignore
176
176
return lines [i ]
177
177
end
178
178
end
179
-
179
+
180
180
-- Debug: Test what the pattern should do
181
181
-- docs/* should match "docs/readme.md" but NOT "docs/sub/readme.md"
182
182
local result = CO .matchFilesToCodeowner ({" docs/sub/readme.md" })
@@ -197,15 +197,15 @@ function TestCO:testCombinedWithGlobalPattern() -- luacheck: ignore 212
197
197
return lines [i ]
198
198
end
199
199
end
200
-
200
+
201
201
-- JS files should match specific owner (*.js overrides *)
202
202
local result1 = CO .matchFilesToCodeowner ({" app.js" })
203
203
lu .assertEquals (result1 , {" @js-owner" })
204
-
204
+
205
205
-- Docs files should match docs owner (docs/* overrides *)
206
206
local result2 = CO .matchFilesToCodeowner ({" docs/README.md" })
207
207
lu .assertEquals (result2 , {" docs@example.com" })
208
-
208
+
209
209
-- Files with no specific pattern should fall back to global owner
210
210
local result3 = CO .matchFilesToCodeowner ({" README.py" })
211
211
lu .assertEquals (result3 , {" @global-owner" })
@@ -221,7 +221,7 @@ function TestCO:testAppsDirectoryPattern() -- luacheck: ignore 212
221
221
return lines [i ]
222
222
end
223
223
end
224
-
224
+
225
225
local result = CO .matchFilesToCodeowner ({" apps/web/index.js" , " apps/mobile/main.kt" })
226
226
lu .assertEquals (result , {" @octocat" })
227
227
end
@@ -236,7 +236,7 @@ function TestCO:testRootDocsDirectoryPattern() -- luacheck: ignore 212
236
236
return lines [i ]
237
237
end
238
238
end
239
-
239
+
240
240
local result = CO .matchFilesToCodeowner ({" /docs/api.md" , " /docs/guides/setup.md" })
241
241
lu .assertEquals (result , {" @doctocat" })
242
242
end
@@ -251,7 +251,7 @@ function TestCO:testRootScriptsDirectoryPattern() -- luacheck: ignore 212
251
251
return lines [i ]
252
252
end
253
253
end
254
-
254
+
255
255
local result = CO .matchFilesToCodeowner ({" /scripts/deploy.sh" , " /scripts/test.py" })
256
256
lu .assertEquals (result , {" @doctocat" , " @octocat" })
257
257
end
@@ -266,7 +266,7 @@ function TestCO:testDoubleStarLogsPattern() -- luacheck: ignore 212
266
266
return lines [i ]
267
267
end
268
268
end
269
-
269
+
270
270
local result = CO .matchFilesToCodeowner ({" build/logs/error.log" , " app/server/logs/access.log" , " logs/debug.log" })
271
271
lu .assertEquals (result , {" @octocat" })
272
272
end
@@ -284,7 +284,7 @@ function TestCO:testAppsWithEmptyGithubSubdirectory() -- luacheck: ignore 212
284
284
return lines [i ]
285
285
end
286
286
end
287
-
287
+
288
288
-- Files in /apps/github should have no owners (empty pattern overrides /apps/)
289
289
local githubResult = CO .matchFilesToCodeowner ({" /apps/github/readme.md" })
290
290
lu .assertEquals (githubResult , {})
@@ -303,7 +303,7 @@ function TestCO:testAppsWithGithubSubdirectoryOwner() -- luacheck: ignore 212
303
303
return lines [i ]
304
304
end
305
305
end
306
-
306
+
307
307
-- Files in /apps/github should have @doctocat (overrides /apps/)
308
308
local githubResult = CO .matchFilesToCodeowner ({" /apps/github/readme.md" })
309
309
lu .assertEquals (githubResult , {" @doctocat" })
0 commit comments