MCPcopy Index your code
hub / github.com/writefreely/writefreely / TestApplyBasicMarkdown

Function TestApplyBasicMarkdown

postrender_test.go:15–43  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

13import "testing"
14
15func TestApplyBasicMarkdown(t *testing.T) {
16 tests := []struct {
17 name string
18 in string
19 result string
20 }{
21 {"empty", "", ""},
22 {"empty spaces", " ", ""},
23 {"empty tabs", "\t", ""},
24 {"empty newline", "\n", ""},
25 {"nums", "123", "123"},
26 {"dot", ".", "."},
27 {"dash", "-", "-"},
28 {"plain", "Hello, World!", "Hello, World!"},
29 {"multibyte", "こんにちは", `こんにちは`},
30 {"bold", "**안녕하세요**", `<strong>안녕하세요</strong>`},
31 {"link", "[WriteFreely](https://writefreely.org)", `<a href="https://writefreely.org" rel="nofollow">WriteFreely</a>`},
32 {"date", "12. April", `12. April`},
33 {"table", "| Hi | There |", `| Hi | There |`},
34 }
35 for _, test := range tests {
36 t.Run(test.name, func(t *testing.T) {
37 res := applyBasicMarkdown([]byte(test.in))
38 if res != test.result {
39 t.Errorf("%s: wanted %s, got %s", test.name, test.result, res)
40 }
41 })
42 }
43}

Callers

nothing calls this directly

Calls 1

applyBasicMarkdownFunction · 0.85

Tested by

no test coverage detected