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

Function TestStringSource_SnippetMultiline

common/source_test.go:90–117  ·  view source on GitHub ↗

TestStringSource_SnippetMultiline snippets of text from a multiline source.

(t *testing.T)

Source from the content-addressed store, hash-verified

88
89// TestStringSource_SnippetMultiline snippets of text from a multiline source.
90func TestStringSource_SnippetMultiline(t *testing.T) {
91 source := NewStringSource("hello\nworld\nmy\nbub\n", "four-line-test")
92 if str, found := source.Snippet(1); !found {
93 t.Errorf(snippetNotFound, t.Name(), 1)
94 } else if str != "hello" {
95 t.Errorf(unexpectedSnippet, t.Name(), str, "hello")
96 }
97 if str2, found := source.Snippet(2); !found {
98 t.Errorf(snippetNotFound, t.Name(), 2)
99 } else if str2 != "world" {
100 t.Errorf(unexpectedSnippet, t.Name(), str2, "world")
101 }
102 if str3, found := source.Snippet(3); !found {
103 t.Errorf(snippetNotFound, t.Name(), 3)
104 } else if str3 != "my" {
105 t.Errorf(unexpectedSnippet, t.Name(), str3, "my")
106 }
107 if str4, found := source.Snippet(4); !found {
108 t.Errorf(snippetNotFound, t.Name(), 4)
109 } else if str4 != "bub" {
110 t.Errorf(unexpectedSnippet, t.Name(), str4, "bub")
111 }
112 if str5, found := source.Snippet(5); !found {
113 t.Errorf(snippetNotFound, t.Name(), 5)
114 } else if str5 != "" {
115 t.Errorf(unexpectedSnippet, t.Name(), str5, "")
116 }
117}
118
119// TestStringSource_SnippetSingleline snippets from a single line source.
120func TestStringSource_SnippetSingleline(t *testing.T) {

Callers

nothing calls this directly

Calls 3

NewStringSourceFunction · 0.85
SnippetMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected