diff options
author | Chris Trimble <trimbo@gmail.com> | 2019-11-24 20:57:39 +0300 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2019-11-25 11:46:44 +0300 |
commit | 8a89b8582f0f681dc28961adb05ab0bf66da9543 (patch) | |
tree | 4dca6f3bb2212bdeb466505237820451e0d0a0ed /commands/import_jekyll_test.go | |
parent | e1175ae83a365e0b17ec5904194e68ff3833e15a (diff) |
commands: Fix jekyll metadata import on individual posts
Prior refactor had eliminated writing FrontMatter for Jekyll imports. This
fixes that bug as well as adds a regression test.
Also removed unused site var, replaced some raw strings, and added regression
test for \r\n removal.
Fixes #5576
Diffstat (limited to 'commands/import_jekyll_test.go')
-rw-r--r-- | commands/import_jekyll_test.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/commands/import_jekyll_test.go b/commands/import_jekyll_test.go index 4ae26b95c..c87c224b2 100644 --- a/commands/import_jekyll_test.go +++ b/commands/import_jekyll_test.go @@ -91,11 +91,12 @@ func TestConvertJekyllContent(t *testing.T) { expect string }{ {map[interface{}]interface{}{}, - `Test content\n<!-- more -->\npart2 content`, `Test content\n<!--more-->\npart2 content`}, + "Test content\r\n<!-- more -->\npart2 content", "Test content\n<!--more-->\npart2 content"}, {map[interface{}]interface{}{}, - `Test content\n<!-- More -->\npart2 content`, `Test content\n<!--more-->\npart2 content`}, + "Test content\n<!-- More -->\npart2 content", "Test content\n<!--more-->\npart2 content"}, {map[interface{}]interface{}{"excerpt_separator": "<!--sep-->"}, - `Test content\n<!--sep-->\npart2 content`, `Test content\n<!--more-->\npart2 content`}, + "Test content\n<!--sep-->\npart2 content", + "---\nexcerpt_separator: <!--sep-->\n---\nTest content\n<!--more-->\npart2 content"}, {map[interface{}]interface{}{}, "{% raw %}text{% endraw %}", "text"}, {map[interface{}]interface{}{}, "{%raw%} text2 {%endraw %}", "text2"}, {map[interface{}]interface{}{}, @@ -124,10 +125,13 @@ func TestConvertJekyllContent(t *testing.T) { {map[interface{}]interface{}{}, "{% img right /placekitten/300/500 'Place Kitten #4' 'An image of a very cute kitten' %}", "{{< figure class=\"right\" src=\"/placekitten/300/500\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}"}, + {map[interface{}]interface{}{"category": "book", "layout": "post", "Date": "2015-10-01 12:13:11"}, + "somecontent", + "---\nDate: \"2015-10-01 12:13:11\"\ncategory: book\nlayout: post\n---\nsomecontent"}, } - for _, data := range testDataList { - result := convertJekyllContent(data.metadata, data.content) - c.Assert(data.expect, qt.Equals, result) + result, err := convertJekyllContent(data.metadata, data.content) + c.Assert(result, qt.Equals, data.expect) + c.Assert(err, qt.IsNil) } } |