Skip to content

Commit

Permalink
add test for #126
Browse files Browse the repository at this point in the history
  • Loading branch information
kjk committed Sep 18, 2021
1 parent 0410668 commit e0533ec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions block_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package markdown

import (
"bytes"
"testing"

"github.com/gomarkdown/markdown/ast"
"github.com/gomarkdown/markdown/html"
"github.com/gomarkdown/markdown/parser"
)
Expand Down Expand Up @@ -178,3 +180,19 @@ func TestLists(t *testing.T) {
exts := parser.CommonExtensions
doTestsParam(t, tests, TestParams{extensions: exts})
}

func TestBug126(t *testing.T) {
// there's a space after end of table header, which used to break table parsing
input := "> ```\n> fenced pre block 1\n> ```\n\n```\nfenced pre block 2\n````\n"
p := parser.NewWithExtensions(parser.CommonExtensions)
doc := p.Parse([]byte(input))
var buf bytes.Buffer
ast.Print(&buf, doc)
got := buf.String()
// TODO: needs fixing https://github.com/gomarkdown/markdown/issues/126
exp := "BlockQuote\n CodeBlock '> fenced pre block 1\\n> ```\\n\\n'\n Paragraph\n Text 'fenced pre block 2\\n````'\n"
if got != exp {
t.Errorf("\nInput [%#v]\nExpected[%#v]\nGot [%#v]\n",
input, exp, got)
}
}

0 comments on commit e0533ec

Please sign in to comment.