MCPcopy Create free account
hub / github.com/celer-pkg/celer / TestIntegrateCmd_DetectShell_PanicSafe

Function TestIntegrateCmd_DetectShell_PanicSafe

cmds/cmd_integrate_test.go:201–223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func 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}

Callers

nothing calls this directly

Calls 3

detectShellMethod · 0.95
validateEnvironmentMethod · 0.95
RemoveAllForTestFunction · 0.92

Tested by

no test coverage detected