| 1 | package hook |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestPwshMatchesLegacyShellHooks(t *testing.T) { |
| 6 | for _, match := range []string{"bash", "Bash", "powershell", "PowerShell"} { |
| 7 | native := ResolvedHook{HookConfig: HookConfig{Match: match}, Event: PreToolUse} |
| 8 | if !MatchesTool(native, "pwsh") { |
| 9 | t.Fatalf("native %s hook should match pwsh", match) |
| 10 | } |
| 11 | } |
| 12 | claudeHook := ResolvedHook{HookConfig: HookConfig{Match: "Bash", PayloadFormat: "claude"}, Event: PreToolUse} |
| 13 | if !MatchesTool(claudeHook, "pwsh") || claudeFacingToolName("pwsh") != "Bash" { |
| 14 | t.Fatal("Claude Bash hook should receive pwsh as Bash") |
| 15 | } |
| 16 | } |
| 17 |