diff --git a/block_test.go b/block_test.go index 62d9a47..83ed2e1 100644 --- a/block_test.go +++ b/block_test.go @@ -1713,3 +1713,28 @@ func TestIsFenceLine(t *testing.T) { } } } + +func TestJoinLines(t *testing.T) { + input := `# 标题 + +第一 +行文字。 + +第 +二 +行文字。 +` + result := `

标题

+ +

第一行文字。

+ +

第二行文字。

+` + opt := Options{Extensions: commonExtensions | EXTENSION_JOIN_LINES} + renderer := HtmlRenderer(commonHtmlFlags, "", "") + output := MarkdownOptions([]byte(input), renderer, opt) + + if string(output) != result { + t.Error("output dose not match.") + } +} diff --git a/markdown_test.go b/markdown_test.go index 34d5efe..d897644 100644 --- a/markdown_test.go +++ b/markdown_test.go @@ -14,8 +14,6 @@ package blackfriday import ( - "io/ioutil" - "os" "testing" ) @@ -75,31 +73,3 @@ 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 deleted file mode 100644 index 704ff27..0000000 --- a/testdata/zhJoinLines.text +++ /dev/null @@ -1,8 +0,0 @@ -# 标题 - -第一 -行文字。 - -第 -二 -行文字。