MCPcopy
hub / github.com/grpc/grpc-go / TestBuffer_SliceSubslice

Method TestBuffer_SliceSubslice

mem/buffers_test.go:389–400  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

387}
388
389func (s) TestBuffer_SliceSubslice(t *testing.T) {
390 for _, c := range ctors {
391 t.Run(c.name+" subslice", func(t *testing.T) {
392 buf := c.newBuf([]byte{1, 2, 3, 4})
393 slice := buf.Slice(1, 3)
394 slice2 := slice.Slice(0, 1)
395 if !bytes.Equal(slice2.ReadOnlyData(), []byte{2}) {
396 t.Fatalf("Buffer did not contain expected data. got %v, want %v", buf.ReadOnlyData(), []byte{2})
397 }
398 })
399 }
400}
401
402func (s) TestBuffer_SliceEmpty(t *testing.T) {
403 allCtors := append(slices.Clip(ctors), namedCtor{name: "empty", newBuf: newEmptyBuf})

Callers

nothing calls this directly

Calls 4

SliceMethod · 0.65
EqualMethod · 0.65
ReadOnlyDataMethod · 0.65
FatalfMethod · 0.65

Tested by

no test coverage detected