MCPcopy
hub / github.com/TarsCloud/TarsGo / TestSkipString

Function TestSkipString

tars/protocol/codec/codec_test.go:185–204  ·  view source on GitHub ↗

TestSkipString tests skip the string.

(t *testing.T)

Source from the content-addressed store, hash-verified

183
184// TestSkipString tests skip the string.
185func TestSkipString(t *testing.T) {
186 b := NewBuffer()
187 for i := 0; i < 200; i++ {
188 bs := make([]byte, 200+i)
189 err := b.WriteString(string(bs), byte(i))
190 if err != nil {
191 t.Error(err)
192 }
193 }
194
195 var data string
196 err := r(b).ReadString(&data, byte(190), true)
197 if err != nil {
198 t.Error(err)
199 }
200 bs := make([]byte, 200+190)
201 if data != string(bs) {
202 t.Error("no eq.")
203 }
204}
205
206// TestSkipStruct tests skip struct.
207func TestSkipStruct(t *testing.T) {

Callers

nothing calls this directly

Calls 5

WriteStringMethod · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ReadStringMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected