TestStringSource_SnippetSingleline snippets from a single line source.
(t *testing.T)
| 118 | |
| 119 | // TestStringSource_SnippetSingleline snippets from a single line source. |
| 120 | func 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 | |
| 135 | func TestNewInfoSource_NoPanicOnNil(t *testing.T) { |
| 136 | // Ensure there is no panic when passing nil, NewInfoSource should use proto v2 style accessors. |
nothing calls this directly
no test coverage detected