MCPcopy
hub / github.com/gofiber/fiber / TestMarshalUnmarshalitem

Function TestMarshalUnmarshalitem

middleware/cache/manager_msgp_test.go:125–146  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

123}
124
125func TestMarshalUnmarshalitem(t *testing.T) {
126 v := item{}
127 bts, err := v.MarshalMsg(nil)
128 if err != nil {
129 t.Fatal(err)
130 }
131 left, err := v.UnmarshalMsg(bts)
132 if err != nil {
133 t.Fatal(err)
134 }
135 if len(left) > 0 {
136 t.Errorf("%d bytes left over after UnmarshalMsg(): %q", len(left), left)
137 }
138
139 left, err = msgp.Skip(bts)
140 if err != nil {
141 t.Fatal(err)
142 }
143 if len(left) > 0 {
144 t.Errorf("%d bytes left over after Skip(): %q", len(left), left)
145 }
146}
147
148func BenchmarkMarshalMsgitem(b *testing.B) {
149 v := item{}

Callers

nothing calls this directly

Calls 4

MarshalMsgMethod · 0.95
UnmarshalMsgMethod · 0.95
FatalMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected