MCPcopy Create free account
hub / github.com/diillson/chatcli / TestMatchToolPattern

Function TestMatchToolPattern

cli/hooks/hooks_test.go:18–35  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

16}
17
18func TestMatchToolPattern(t *testing.T) {
19 tests := []struct {
20 pattern string
21 tool string
22 expected bool
23 }{
24 {"*", "anything", true},
25 {"mcp_*", "mcp_read_file", true},
26 {"mcp_*", "@coder", false},
27 {"@coder", "@coder", true},
28 {"@coder", "@other", false},
29 }
30 for _, tt := range tests {
31 if got := matchToolPattern(tt.pattern, tt.tool); got != tt.expected {
32 t.Errorf("matchToolPattern(%q, %q) = %v, want %v", tt.pattern, tt.tool, got, tt.expected)
33 }
34 }
35}
36
37func TestHookConfig_IsEnabled(t *testing.T) {
38 h1 := HookConfig{Name: "test"}

Callers

nothing calls this directly

Calls 2

matchToolPatternFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected