MCPcopy Index your code
hub / github.com/expr-lang/expr / TestStringSource_SnippetMultiLine

Function TestStringSource_SnippetMultiLine

file/source_test.go:13–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func TestStringSource_SnippetMultiLine(t *testing.T) {
14 source := NewSource("hello\nworld\nmy\nbub\n")
15 if str, found := source.Snippet(1); !found {
16 t.Errorf(snippetNotFound, t.Name(), 1)
17 } else if str != "hello" {
18 t.Errorf(unexpectedSnippet, t.Name(), str, "hello")
19 }
20 if str2, found := source.Snippet(2); !found {
21 t.Errorf(snippetNotFound, t.Name(), 2)
22 } else if str2 != "world" {
23 t.Errorf(unexpectedSnippet, t.Name(), str2, "world")
24 }
25 if str3, found := source.Snippet(3); !found {
26 t.Errorf(snippetNotFound, t.Name(), 3)
27 } else if str3 != "my" {
28 t.Errorf(unexpectedSnippet, t.Name(), str3, "my")
29 }
30 if str4, found := source.Snippet(4); !found {
31 t.Errorf(snippetNotFound, t.Name(), 4)
32 } else if str4 != "bub" {
33 t.Errorf(unexpectedSnippet, t.Name(), str4, "bub")
34 }
35 if str5, found := source.Snippet(5); !found {
36 t.Errorf(snippetNotFound, t.Name(), 5)
37 } else if str5 != "" {
38 t.Errorf(unexpectedSnippet, t.Name(), str5, "")
39 }
40}
41
42func TestStringSource_SnippetSingleLine(t *testing.T) {
43 source := NewSource("hello, world")

Callers

nothing calls this directly

Calls 4

SnippetMethod · 0.95
NewSourceFunction · 0.85
ErrorfMethod · 0.65
NameMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…