MCPcopy Create free account
hub / github.com/cockroachdb/redact / checkInvariants

Method checkInvariants

internal/buffer/buffer_test.go:25–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func (b *Buffer) checkInvariants(t *testing.T) {
26 t.Helper()
27 if !utf8.Valid(b.buf[:b.validUntil]) {
28 t.Errorf("invalid utf-8 sequence in string: %q", string(b.buf[:b.validUntil]))
29 }
30
31 copy := *b
32 copy.finalize()
33 checkBalanced(t, string(copy.buf))
34}
35
36func checkBalanced(t *testing.T, s string) {
37 t.Helper()

Callers 4

TestBufferUnsafeWritesFunction · 0.95
TestBufferRawSafeWritesFunction · 0.95

Calls 2

checkBalancedFunction · 0.85
finalizeMethod · 0.80

Tested by

no test coverage detected