MCPcopy
hub / github.com/larksuite/cli / TestResolveInputFlags_DuplicateStdin

Function TestResolveInputFlags_DuplicateStdin

shortcuts/common/runner_input_test.go:208–228  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

206}
207
208func TestResolveInputFlags_DuplicateStdin(t *testing.T) {
209 rctx := newTestRuntimeWithStdin(map[string]string{"a": "-", "b": "-"}, "data")
210 flags := []Flag{
211 {Name: "a", Input: []string{Stdin}},
212 {Name: "b", Input: []string{Stdin}},
213 }
214
215 err := resolveInputFlags(rctx, flags)
216 if err == nil {
217 t.Fatal("expected error for duplicate stdin usage")
218 }
219 vErr := assertValidationParam(t, err, "--b")
220 if !strings.Contains(vErr.Message, "stdin (-) can only be used by one flag") {
221 t.Errorf("unexpected error message: %q", vErr.Message)
222 }
223 // The hint must steer an AI agent to the fix (@file for the extra flags),
224 // since `--a - <x --b - <y` is the exact misuse this guards against.
225 if !strings.Contains(vErr.Hint, "@file") {
226 t.Errorf("hint %q should mention @file as the fix", vErr.Hint)
227 }
228}
229
230func TestStripUTF8BOM(t *testing.T) {
231 cases := []struct{ name, in, want string }{

Callers

nothing calls this directly

Calls 4

newTestRuntimeWithStdinFunction · 0.85
resolveInputFlagsFunction · 0.85
assertValidationParamFunction · 0.70
ContainsMethod · 0.45

Tested by

no test coverage detected