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

Function TestNewBuffer_All

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

Source from the content-addressed store, hash-verified

71}
72
73func TestNewBuffer_All(t *testing.T) {
74 data := "hell\u04E7 w\U0001F642rld!"
75 rb := NewBuffer(data)
76 if got, want := rb.Len(), utf8.RuneCountInString(data); got != want {
77 t.Errorf("length mismatch: got %d, want %d", got, want)
78 }
79 if got, want := rb.Slice(0, rb.Len()), data; got != want {
80 t.Errorf("slice mismatch: got %q, want %q", got, want)
81 }
82 if got, want := rb.Get(8), rune('r'); got != want {
83 t.Errorf("rune mismatch: got %U, want %U", got, want)
84 }
85 if _, ok := rb.(*supplementalBuffer); !ok {
86 t.Errorf("type mismatch: got %T, want %T", rb, &supplementalBuffer{})
87 }
88}
89
90func TestNewBuffer_Empty(t *testing.T) {
91 data := ""

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