Skip to content

Commit

Permalink
modify testcase of joinLine.
Browse files Browse the repository at this point in the history
1. delete testdata 'zhJoinLines.txt'.
2. move the testcase from markdown_test.go into block_test.go.
  • Loading branch information
choueric committed Mar 17, 2017
1 parent 8098dab commit f0bb45f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 38 deletions.
25 changes: 25 additions & 0 deletions block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1713,3 +1713,28 @@ func TestIsFenceLine(t *testing.T) {
}
}
}

func TestJoinLines(t *testing.T) {
input := `# 标题
第一
行文字。
行文字。
`
result := `<h1>标题</h1>
<p>第一行文字。</p>
<p>第二行文字。</p>
`
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.")
}
}
30 changes: 0 additions & 30 deletions markdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
package blackfriday

import (
"io/ioutil"
"os"
"testing"
)

Expand Down Expand Up @@ -75,31 +73,3 @@ 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 changes: 0 additions & 8 deletions testdata/zhJoinLines.text

This file was deleted.

0 comments on commit f0bb45f

Please sign in to comment.