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

Function TestResolveInputFlags_StripBOMStdin

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

Source from the content-addressed store, hash-verified

244}
245
246func 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
260func TestResolveInputFlags_StripBOMFile(t *testing.T) {
261 dir := t.TempDir()

Callers

nothing calls this directly

Calls 3

newTestRuntimeWithStdinFunction · 0.85
resolveInputFlagsFunction · 0.85
StrMethod · 0.65

Tested by

no test coverage detected