(t *testing.T)
| 350 | } |
| 351 | |
| 352 | func 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 | } |
nothing calls this directly
no test coverage detected