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

Function TestNewBuffer_ASCII

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

Source from the content-addressed store, hash-verified

20)
21
22func TestNewBuffer_ASCII(t *testing.T) {
23 data := "hello world!"
24 rb := NewBuffer(data)
25 if got, want := rb.Len(), utf8.RuneCountInString(data); got != want {
26 t.Errorf("length mismatch: got %d, want %d", got, want)
27 }
28 if got, want := rb.Slice(0, rb.Len()), data; got != want {
29 t.Errorf("slice mismatch: got %q, want %q", got, want)
30 }
31 if got, want := rb.Get(8), rune('r'); got != want {
32 t.Errorf("rune mismatch: got %U, want %U", got, want)
33 }
34 if _, ok := rb.(*asciiBuffer); !ok {
35 t.Errorf("type mismatch: got %T, want %T", rb, &asciiBuffer{})
36 }
37}
38
39func TestNewBuffer_Basic(t *testing.T) {
40 data := "hello w\u04E7rld!"

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