Skip to content

Commit

Permalink
Fix bug in multi comment
Browse files Browse the repository at this point in the history
  • Loading branch information
minodisk committed Feb 19, 2016
1 parent 140a390 commit 0022947
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 2 deletions.
2 changes: 1 addition & 1 deletion model/post.go
Expand Up @@ -32,7 +32,7 @@ const (
)

var (
rPostDecoder = regexp.MustCompile(`^(?ms:\n*<!--(.*)-->\n{2,}# +(.*?)\n+(.*))$`)
rPostDecoder = regexp.MustCompile(`^(?ms:\n*<!--(.*?)-->\n{2,}# +(.*?)\n+(.*))$`)
tmpl = func() (t *template.Template) {
t = template.New("postfile")
template.Must(t.Parse(postTemplate))
Expand Down
33 changes: 32 additions & 1 deletion model/post_test.go
Expand Up @@ -1733,6 +1733,37 @@ Paragraph
}
}

func TestPostDecodeWithMultiComment(t *testing.T) {
testutil.CleanUp()
defer testutil.CleanUp()

var post model.Post
err := post.Decode([]byte(`<!--
id: ""
url: ""
created_at: 2016-02-17T13:08:30+09:00
updated_at: 2016-02-17T13:08:30+09:00
private: false
coediting: false
tags:
- Qiita
- Go
team: null
-->
# Example Title
<!--
This is not meta
-->
# This is not title of this post
`))
if err != nil {
t.Fatal(err)
}
}

func TestPostDecodeWithWrongTag(t *testing.T) {
testutil.CleanUp()
defer testutil.CleanUp()
Expand Down Expand Up @@ -1765,7 +1796,7 @@ Paragraph
}
}

func TestDecodeWithWrongTitle(t *testing.T) {
func TestPostDecodeWithWrongTitle(t *testing.T) {
testutil.CleanUp()
defer testutil.CleanUp()

Expand Down

0 comments on commit 0022947

Please sign in to comment.