TestStringSource_SnippetMultiline snippets of text from a multiline source.
(t *testing.T)
| 88 | |
| 89 | // TestStringSource_SnippetMultiline snippets of text from a multiline source. |
| 90 | func 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. |
| 120 | func TestStringSource_SnippetSingleline(t *testing.T) { |
nothing calls this directly
no test coverage detected