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

Function TestReader_ToBytes

tars/protocol/codec/codec_test.go:530–542  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

528}
529
530func TestReader_ToBytes(t *testing.T) {
531 writer := NewBuffer()
532 want := []byte("hellotars")
533 err := writer.WriteBytes(want)
534 if err != nil {
535 t.Errorf("Write bytes failed")
536 }
537 reader := r(writer)
538 got := reader.ToBytes()
539 if string(got) != string(want) {
540 t.Errorf("Test reader ToBytes failed. want:%v, got:%v\n", want, got)
541 }
542}
543
544func TestReader_unreadHead(t *testing.T) {
545 writer := NewBuffer()

Callers

nothing calls this directly

Calls 5

WriteBytesMethod · 0.95
NewBufferFunction · 0.85
rFunction · 0.85
ErrorfMethod · 0.45
ToBytesMethod · 0.45

Tested by

no test coverage detected