MCPcopy Create free account
hub / github.com/Shopify/goose / check

Function check

syncio/buffer_test.go:31–49  ·  view source on GitHub ↗

Verify that contents of buf match the string s.

(t *testing.T, testname string, buf *Buffer, s string)

Source from the content-addressed store, hash-verified

29
30// Verify that contents of buf match the string s.
31func check(t *testing.T, testname string, buf *Buffer, s string) {
32 bytes := buf.Bytes()
33 str := buf.String()
34 if buf.Len() != len(bytes) {
35 t.Errorf("%s: buf.Len() == %d, len(buf.Bytes()) == %d", testname, buf.Len(), len(bytes))
36 }
37
38 if buf.Len() != len(str) {
39 t.Errorf("%s: buf.Len() == %d, len(buf.String()) == %d", testname, buf.Len(), len(str))
40 }
41
42 if buf.Len() != len(s) {
43 t.Errorf("%s: buf.Len() == %d, len(s) == %d", testname, buf.Len(), len(s))
44 }
45
46 if string(bytes) != s {
47 t.Errorf("%s: string(buf.Bytes()) == %q, s == %q", testname, string(bytes), s)
48 }
49}
50
51// Fill buf through n writes of string fus.
52// The initial contents of buf corresponds to the string s;

Callers 10

fillStringFunction · 0.85
fillBytesFunction · 0.85
TestNewBufferFunction · 0.85
TestNewBufferStringFunction · 0.85
emptyFunction · 0.85
TestBasicOperationsFunction · 0.85
TestLargeStringWritesFunction · 0.85
TestLargeByteWritesFunction · 0.85
TestLargeStringReadsFunction · 0.85
TestLargeByteReadsFunction · 0.85

Calls 3

BytesMethod · 0.80
StringMethod · 0.45
LenMethod · 0.45

Tested by

no test coverage detected