MCPcopy
hub / github.com/x-motemen/gore / TestAction_CommandNotFound

Function TestAction_CommandNotFound

commands_test.go:189–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

187}
188
189func TestAction_CommandNotFound(t *testing.T) {
190 var stdout, stderr strings.Builder
191 s, err := NewSession(&stdout, &stderr)
192 t.Cleanup(func() { s.Clear() })
193 require.NoError(t, err)
194
195 err = s.Eval(":::")
196 require.NoError(t, err)
197
198 err = s.Eval(":foo")
199 require.Error(t, err)
200
201 err = s.Eval(":ii")
202 require.Error(t, err)
203
204 err = s.Eval(":docc")
205 require.Error(t, err)
206
207 err = s.Eval(":help]")
208 require.Error(t, err)
209
210 assert.Equal(t, "", stdout.String())
211 assert.Equal(t, `command not found: foo
212command not found: ii
213command not found: docc
214command not found: help]
215`, stderr.String())
216}
217
218func TestAction_ArgumentRequired(t *testing.T) {
219 var stdout, stderr strings.Builder

Callers

nothing calls this directly

Calls 5

ClearMethod · 0.95
EvalMethod · 0.95
NewSessionFunction · 0.85
ErrorMethod · 0.80
StringMethod · 0.80

Tested by

no test coverage detected