(t *testing.T)
| 206 | } |
| 207 | |
| 208 | func 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 | |
| 230 | func TestStripUTF8BOM(t *testing.T) { |
| 231 | cases := []struct{ name, in, want string }{ |
nothing calls this directly
no test coverage detected