MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestNewBuffer_Empty

Function TestNewBuffer_Empty

common/runes/buffer_test.go:90–102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

88}
89
90func TestNewBuffer_Empty(t *testing.T) {
91 data := ""
92 rb := NewBuffer(data)
93 if got, want := rb.Len(), utf8.RuneCountInString(data); got != want {
94 t.Errorf("length mismatch: got %d, want %d", got, want)
95 }
96 if got, want := rb.Slice(0, rb.Len()), data; got != want {
97 t.Errorf("slice mismatch: got %q, want %q", got, want)
98 }
99 if _, ok := rb.(*emptyBuffer); !ok {
100 t.Errorf("type mismatch: got %T, want %T", rb, &emptyBuffer{})
101 }
102}
103
104func TestNewBufferAndLineOffsetsWithLimit_Exceeded(t *testing.T) {
105 _, _, err := NewBufferAndLineOffsetsWithLimit("greetings", 5)

Callers

nothing calls this directly

Calls 3

LenMethod · 0.95
SliceMethod · 0.95
NewBufferFunction · 0.85

Tested by

no test coverage detected