diff --git a/markdown_test.go b/markdown_test.go index d897644..34d5efe 100644 --- a/markdown_test.go +++ b/markdown_test.go @@ -14,6 +14,8 @@ package blackfriday import ( + "io/ioutil" + "os" "testing" ) @@ -73,3 +75,31 @@ func TestDocument(t *testing.T) { } doTests(t, tests) } + +func TestJoinLines(t *testing.T) { + result := `

标题

+ +

第一行文字。

+ +

第二行文字。

+` + + file, err := os.Open("testdata/zhJoinLines.text") + if err != nil { + t.Fatal(err) + } + defer file.Close() + + input, err := ioutil.ReadAll(file) + if err != nil { + t.Fatal(err) + } + + opt := Options{Extensions: commonExtensions | EXTENSION_JOIN_LINES} + renderer := HtmlRenderer(commonHtmlFlags, "", "") + output := MarkdownOptions(input, renderer, opt) + + if string(output) != result { + t.Error("output dose not match.") + } +} diff --git a/testdata/zhJoinLines.text b/testdata/zhJoinLines.text new file mode 100644 index 0000000..704ff27 --- /dev/null +++ b/testdata/zhJoinLines.text @@ -0,0 +1,8 @@ +# 标题 + +第一 +行文字。 + +第 +二 +行文字。