MCPcopy Index your code
hub / github.com/github/github-mcp-server / TestParseCommaSeparated

Function TestParseCommaSeparated

pkg/http/headers/parse_test.go:9–58  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestParseCommaSeparated(t *testing.T) {
10 tests := []struct {
11 name string
12 input string
13 expected []string
14 }{
15 {
16 name: "empty string",
17 input: "",
18 expected: []string{},
19 },
20 {
21 name: "single value",
22 input: "foo",
23 expected: []string{"foo"},
24 },
25 {
26 name: "multiple values",
27 input: "foo,bar,baz",
28 expected: []string{"foo", "bar", "baz"},
29 },
30 {
31 name: "whitespace trimmed",
32 input: " foo , bar , baz ",
33 expected: []string{"foo", "bar", "baz"},
34 },
35 {
36 name: "empty values filtered",
37 input: "foo,,bar,",
38 expected: []string{"foo", "bar"},
39 },
40 {
41 name: "only commas",
42 input: ",,,",
43 expected: []string{},
44 },
45 {
46 name: "whitespace only values filtered",
47 input: "foo, ,bar",
48 expected: []string{"foo", "bar"},
49 },
50 }
51
52 for _, tt := range tests {
53 t.Run(tt.name, func(t *testing.T) {
54 result := ParseCommaSeparated(tt.input)
55 assert.Equal(t, tt.expected, result)
56 })
57 }
58}

Callers

nothing calls this directly

Calls 1

ParseCommaSeparatedFunction · 0.85

Tested by

no test coverage detected