(t *testing.T)
| 13 | import "testing" |
| 14 | |
| 15 | func 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 | } |
nothing calls this directly
no test coverage detected