(t *testing.T)
| 28 | ) |
| 29 | |
| 30 | func TestClearText(t *testing.T) { |
| 31 | var ( |
| 32 | expected, |
| 33 | clearedText string |
| 34 | ) |
| 35 | |
| 36 | // test code clear text |
| 37 | expected = "hello{code...}" |
| 38 | clearedText = ClearText("<p>hello<pre>var a = \"good\"</pre></p>") |
| 39 | assert.Equal(t, expected, clearedText) |
| 40 | |
| 41 | // test link clear text |
| 42 | expected = "hello [example.com]" |
| 43 | clearedText = ClearText("<p>hello <a href=\"http://example.com/\">example.com</a></p>") |
| 44 | assert.Equal(t, expected, clearedText) |
| 45 | clearedText = ClearText("<p>hello<a href=\"https://example.com/\">example.com</a></p>") |
| 46 | assert.Equal(t, expected, clearedText) |
| 47 | |
| 48 | expected = "hello world" |
| 49 | clearedText = ClearText("<div> hello</div>\n<div>world</div>") |
| 50 | assert.Equal(t, expected, clearedText) |
| 51 | } |
| 52 | |
| 53 | func TestFetchExcerpt(t *testing.T) { |
| 54 | var ( |
nothing calls this directly
no test coverage detected