(t *testing.T)
| 244 | } |
| 245 | |
| 246 | func TestResolveInputFlags_StripBOMStdin(t *testing.T) { |
| 247 | // A CSV piped via stdin with a leading BOM (e.g. from an upstream export) |
| 248 | // must reach the shortcut without the BOM, so it can't corrupt the first cell. |
| 249 | rctx := newTestRuntimeWithStdin(map[string]string{"csv": "-"}, "\uFEFFname,age\nzhang,8") |
| 250 | flags := []Flag{{Name: "csv", Input: []string{File, Stdin}}} |
| 251 | |
| 252 | if err := resolveInputFlags(rctx, flags); err != nil { |
| 253 | t.Fatalf("unexpected error: %v", err) |
| 254 | } |
| 255 | if got := rctx.Str("csv"); got != "name,age\nzhang,8" { |
| 256 | t.Errorf("leading BOM not stripped from stdin, got %q", got) |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | func TestResolveInputFlags_StripBOMFile(t *testing.T) { |
| 261 | dir := t.TempDir() |
nothing calls this directly
no test coverage detected