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

Function TestStripUTF8BOM

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

Source from the content-addressed store, hash-verified

228}
229
230func TestStripUTF8BOM(t *testing.T) {
231 cases := []struct{ name, in, want string }{
232 {"leading BOM removed", "\uFEFFhello", "hello"},
233 {"no BOM unchanged", "hello", "hello"},
234 {"empty unchanged", "", ""},
235 {"only BOM becomes empty", "\uFEFF", ""},
236 {"interior BOM preserved", "a\uFEFFb", "a\uFEFFb"},
237 {"only the first BOM removed", "\uFEFF\uFEFFx", "\uFEFFx"},
238 }
239 for _, c := range cases {
240 if got := stripUTF8BOM(c.in); got != c.want {
241 t.Errorf("%s: stripUTF8BOM(%q) = %q, want %q", c.name, c.in, got, c.want)
242 }
243 }
244}
245
246func TestResolveInputFlags_StripBOMStdin(t *testing.T) {
247 // A CSV piped via stdin with a leading BOM (e.g. from an upstream export)

Callers

nothing calls this directly

Calls 1

stripUTF8BOMFunction · 0.85

Tested by

no test coverage detected