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

Function TestFetchExcerpt

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

Source from the content-addressed store, hash-verified

51}
52
53func TestFetchExcerpt(t *testing.T) {
54 var (
55 expected,
56 text string
57 )
58
59 // test english string
60 expected = "hello..."
61 text = FetchExcerpt("<p>hello world</p>", "...", 5)
62 assert.Equal(t, expected, text)
63
64 // test mixed string
65 expected = "hello你好..."
66 text = FetchExcerpt("<p>hello你好world</p>", "...", 7)
67 assert.Equal(t, expected, text)
68
69 // test mixed string with emoticon
70 expected = "hello你好😂..."
71 text = FetchExcerpt("<p>hello你好😂world</p>", "...", 8)
72 assert.Equal(t, expected, text)
73
74 expected = "hello你好"
75 text = FetchExcerpt("<p>hello你好</p>", "...", 8)
76 assert.Equal(t, expected, text)
77}
78
79func TestUrlTitle(t *testing.T) {
80 list := []string{

Callers

nothing calls this directly

Calls 1

FetchExcerptFunction · 0.85

Tested by

no test coverage detected