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

Function TestNewBuffer_Basic

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

Source from the content-addressed store, hash-verified

37}
38
39func TestNewBuffer_Basic(t *testing.T) {
40 data := "hello w\u04E7rld!"
41 rb := NewBuffer(data)
42 if got, want := rb.Len(), utf8.RuneCountInString(data); got != want {
43 t.Errorf("length mismatch: got %d, want %d", got, want)
44 }
45 if got, want := rb.Slice(0, rb.Len()), data; got != want {
46 t.Errorf("slice mismatch: got %q, want %q", got, want)
47 }
48 if got, want := rb.Get(8), rune('r'); got != want {
49 t.Errorf("rune mismatch: got %U, want %U", got, want)
50 }
51 if _, ok := rb.(*basicBuffer); !ok {
52 t.Errorf("type mismatch: got %T, want %T", rb, &basicBuffer{})
53 }
54}
55
56func TestNewBuffer_Supplemental(t *testing.T) {
57 data := "hello w\U0001F642rld!"

Callers

nothing calls this directly

Calls 4

LenMethod · 0.95
SliceMethod · 0.95
GetMethod · 0.95
NewBufferFunction · 0.85

Tested by

no test coverage detected