MCPcopy Index your code
hub / github.com/docker/docker-agent / TestCompiledMatcherMatchTool

Function TestCompiledMatcherMatchTool

pkg/hooks/hooks_test.go:271–351  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

269}
270
271func 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 {

Callers

nothing calls this directly

Calls 4

NewExecutorFunction · 0.85
matchesMethod · 0.80
RunMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected