MCPcopy Index your code
hub / github.com/dunglas/httpsfv / FuzzUnmarshalList

Function FuzzUnmarshalList

list_test.go:104–150  ·  view source on GitHub ↗
(f *testing.F)

Source from the content-addressed store, hash-verified

102}
103
104func FuzzUnmarshalList(f *testing.F) {
105 testCases := []string{"",
106 "foo,bar",
107 "foo, bar",
108 "foo,\t bar",
109 "foo", "bar",
110 `"foo";bar;baz=tok`,
111 `(foo bar);bat`,
112 `()`,
113 ` "foo";bar;baz=tok, (foo bar);bat `,
114 `foo,bar,`,
115 `foo,baré`,
116 `é`,
117 `foo,"bar" é`,
118 `(foo `,
119 `(foo);é`,
120 `("é")`,
121 `(""`,
122 `(`,
123 "1.9",
124 }
125
126 for _, t := range testCases {
127 f.Add(t)
128 }
129
130 f.Fuzz(func(t *testing.T, b string) {
131 unmarshaled, err := UnmarshalList([]string{b})
132 if err != nil {
133 return
134 }
135
136 reMarshaled, err := Marshal(unmarshaled)
137 if err != nil {
138 t.Errorf("Unexpected marshaling error %q for %q, %#v", err, b, unmarshaled)
139 }
140
141 reUnmarshaled, err := UnmarshalList([]string{reMarshaled})
142 if err != nil {
143 t.Errorf("Unexpected remarshaling error %q for %q; original %q", err, reMarshaled, b)
144 }
145
146 if !reflect.DeepEqual(unmarshaled, reUnmarshaled) {
147 t.Errorf("Unmarshaled and re-unmarshaled doesn't match: %#v; %#v", unmarshaled, reUnmarshaled)
148 }
149 })
150}

Callers

nothing calls this directly

Calls 3

UnmarshalListFunction · 0.85
MarshalFunction · 0.85
AddMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…