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

Function TestGetSuggestedPattern

cli/coder/normalize_test.go:352–374  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

350}
351
352func TestGetSuggestedPattern(t *testing.T) {
353 tests := []struct {
354 name string
355 toolName string
356 args string
357 want string
358 }{
359 {"json read", "@coder", `{"cmd":"read","args":{"file":"x"}}`, "@coder read"},
360 {"cli exec returns empty to prevent blanket allow", "@coder", `exec --cmd ls`, ""},
361 {"json exec returns empty", "@coder", `{"cmd":"exec","args":{"cmd":"ls -la"}}`, ""},
362 {"empty args", "@coder", "", "@coder"},
363 {"bypass attempt", "@coder", `{"args":{"file":"x"}}`, "@coder"},
364 }
365
366 for _, tt := range tests {
367 t.Run(tt.name, func(t *testing.T) {
368 got := GetSuggestedPattern(tt.toolName, tt.args)
369 if got != tt.want {
370 t.Errorf("GetSuggestedPattern() = %q, want %q", got, tt.want)
371 }
372 })
373 }
374}

Callers

nothing calls this directly

Calls 3

GetSuggestedPatternFunction · 0.85
ErrorfMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected