mirror of
https://github.com/status-im/markdown.git
synced 2025-02-23 08:38:23 +00:00
add testcase for joinLines extension
This commit is contained in:
parent
3ffe8c7f6b
commit
8098dab4eb
@ -14,6 +14,8 @@
|
|||||||
package blackfriday
|
package blackfriday
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -73,3 +75,31 @@ func TestDocument(t *testing.T) {
|
|||||||
}
|
}
|
||||||
doTests(t, tests)
|
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
8
testdata/zhJoinLines.text
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
# 标题
|
||||||
|
|
||||||
|
第一
|
||||||
|
行文字。
|
||||||
|
|
||||||
|
第
|
||||||
|
二
|
||||||
|
行文字。
|
Loading…
x
Reference in New Issue
Block a user