MCPcopy Index your code
hub / github.com/jetify-com/devbox / TestTaskConfirmPromptDeny

Function TestTaskConfirmPromptDeny

internal/setup/setup_test.go:115–130  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

113}
114
115func TestTaskConfirmPromptDeny(t *testing.T) {
116 tempXDGStateDir(t)
117
118 task := &testTask{
119 RunFunc: func(ctx context.Context) error { return nil },
120 NeedsRunFunc: func(context.Context, RunInfo) bool { return true },
121 }
122
123 setPromptResponse(t, false)
124 err := ConfirmRun(t.Context(), t.Name(), task, "continue?")
125 if err == nil {
126 t.Error("got nil error, want ErrUserRefused")
127 } else if !errors.Is(err, ErrUserRefused) {
128 t.Error("got errors.Is(err, ErrUserRefused) == false for error:", err)
129 }
130}
131
132// TestSudoDevbox uses sudo on the current test binary to recursively call
133// itself as root. This test can only be run manually (because it needs sudo)

Callers

nothing calls this directly

Calls 5

tempXDGStateDirFunction · 0.85
setPromptResponseFunction · 0.85
ConfirmRunFunction · 0.85
IsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected