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

Function TestStringSource_SnippetSingleline

common/source_test.go:120–133  ·  view source on GitHub ↗

TestStringSource_SnippetSingleline snippets from a single line source.

(t *testing.T)

Source from the content-addressed store, hash-verified

118
119// TestStringSource_SnippetSingleline snippets from a single line source.
120func TestStringSource_SnippetSingleline(t *testing.T) {
121 source := NewStringSource("hello, world", "one-line-test")
122 if str, found := source.Snippet(1); !found {
123 t.Errorf(snippetNotFound, t.Name(), 1)
124
125 } else if str != "hello, world" {
126 t.Errorf(unexpectedSnippet, t.Name(), str, "hello, world")
127 }
128 if str2, found := source.Snippet(2); found {
129 t.Errorf(snippetFound, t.Name(), 2)
130 } else if str2 != "" {
131 t.Errorf(unexpectedSnippet, t.Name(), str2, "")
132 }
133}
134
135func TestNewInfoSource_NoPanicOnNil(t *testing.T) {
136 // Ensure there is no panic when passing nil, NewInfoSource should use proto v2 style accessors.

Callers

nothing calls this directly

Calls 3

NewStringSourceFunction · 0.85
SnippetMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected