MCPcopy Index your code
hub / github.com/apache/answer / TestClearText

Function TestClearText

pkg/htmltext/htmltext_test.go:30–51  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func 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
53func TestFetchExcerpt(t *testing.T) {
54 var (

Callers

nothing calls this directly

Calls 1

ClearTextFunction · 0.85

Tested by

no test coverage detected