add testcase for joinLines extension

pull/334/head
choueric 2017-02-22 09:18:21 +08:00
parent 3ffe8c7f6b
commit 8098dab4eb
2 changed files with 38 additions and 0 deletions

View File

@ -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 := `<h1></h1>
<p></p>
<p></p>
`
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.")
}
}

8
testdata/zhJoinLines.text vendored Normal file
View File

@ -0,0 +1,8 @@
# 标题
第一
行文字。
行文字。