(t *testing.T)
| 199 | } |
| 200 | |
| 201 | func TestIntegrateCmd_DetectShell_PanicSafe(t *testing.T) { |
| 202 | // Cleanup. |
| 203 | dirs.RemoveAllForTest() |
| 204 | |
| 205 | oldCurrentShellFn := currentShellFn |
| 206 | t.Cleanup(func() { |
| 207 | currentShellFn = oldCurrentShellFn |
| 208 | }) |
| 209 | |
| 210 | currentShellFn = func() completion.ShellType { |
| 211 | panic("unexpected panic") |
| 212 | } |
| 213 | |
| 214 | integrate := &integrateCmd{} |
| 215 | shell := integrate.detectShell() |
| 216 | if shell != completion.NotSupported { |
| 217 | t.Fatalf("expected NotSupported when shell detection panics, got: %v", shell) |
| 218 | } |
| 219 | |
| 220 | if err := integrate.validateEnvironment(shell); err == nil { |
| 221 | t.Fatal("validateEnvironment should return error for NotSupported shell") |
| 222 | } |
| 223 | } |
nothing calls this directly
no test coverage detected