(t *testing.T)
| 351 | } |
| 352 | |
| 353 | func TestExecutePreToolUseWithEchoCommand(t *testing.T) { |
| 354 | t.Parallel() |
| 355 | |
| 356 | config := &Config{ |
| 357 | PreToolUse: []MatcherConfig{ |
| 358 | { |
| 359 | Matcher: "*", |
| 360 | Hooks: []Hook{ |
| 361 | {Type: HookTypeCommand, Command: "echo 'test'", Timeout: 5}, |
| 362 | }, |
| 363 | }, |
| 364 | }, |
| 365 | } |
| 366 | |
| 367 | exec := NewExecutor(config, t.TempDir(), nil) |
| 368 | input := &Input{ |
| 369 | SessionID: "test-session", |
| 370 | ToolName: "shell", |
| 371 | ToolUseID: "test-id", |
| 372 | } |
| 373 | |
| 374 | result, err := exec.Dispatch(t.Context(), EventPreToolUse, input) |
| 375 | require.NoError(t, err) |
| 376 | assert.True(t, result.Allowed) |
| 377 | } |
| 378 | |
| 379 | func TestExecutePreToolUseBlockingExitCode(t *testing.T) { |
| 380 | t.Parallel() |
nothing calls this directly
no test coverage detected