(t *testing.T)
| 269 | } |
| 270 | |
| 271 | func TestCompiledMatcherMatchTool(t *testing.T) { |
| 272 | t.Parallel() |
| 273 | |
| 274 | tests := []struct { |
| 275 | name string |
| 276 | matcher string |
| 277 | toolName string |
| 278 | expected bool |
| 279 | }{ |
| 280 | { |
| 281 | name: "wildcard matches any", |
| 282 | matcher: "*", |
| 283 | toolName: "shell", |
| 284 | expected: true, |
| 285 | }, |
| 286 | { |
| 287 | name: "empty matcher matches any", |
| 288 | matcher: "", |
| 289 | toolName: "shell", |
| 290 | expected: true, |
| 291 | }, |
| 292 | { |
| 293 | name: "exact match", |
| 294 | matcher: "shell", |
| 295 | toolName: "shell", |
| 296 | expected: true, |
| 297 | }, |
| 298 | { |
| 299 | name: "exact match fails", |
| 300 | matcher: "shell", |
| 301 | toolName: "edit_file", |
| 302 | expected: false, |
| 303 | }, |
| 304 | { |
| 305 | name: "alternation match first", |
| 306 | matcher: "shell|edit_file", |
| 307 | toolName: "shell", |
| 308 | expected: true, |
| 309 | }, |
| 310 | { |
| 311 | name: "alternation match second", |
| 312 | matcher: "shell|edit_file", |
| 313 | toolName: "edit_file", |
| 314 | expected: true, |
| 315 | }, |
| 316 | { |
| 317 | name: "alternation no match", |
| 318 | matcher: "shell|edit_file", |
| 319 | toolName: "write_file", |
| 320 | expected: false, |
| 321 | }, |
| 322 | { |
| 323 | name: "regex pattern", |
| 324 | matcher: "mcp__.*", |
| 325 | toolName: "mcp__github_list_repos", |
| 326 | expected: true, |
| 327 | }, |
| 328 | { |
nothing calls this directly
no test coverage detected