diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-12-02 13:23:25 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2020-12-03 13:12:58 +0100 |
commit | d90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch) | |
tree | 7b1b14464eefec1188ca2eed53c64e4823453cc9 /commands/import_jekyll_test.go | |
parent | 32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff) |
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'commands/import_jekyll_test.go')
-rw-r--r-- | commands/import_jekyll_test.go | 116 |
1 files changed, 78 insertions, 38 deletions
diff --git a/commands/import_jekyll_test.go b/commands/import_jekyll_test.go index c87c224b2..3819d03a5 100644 --- a/commands/import_jekyll_test.go +++ b/commands/import_jekyll_test.go @@ -53,25 +53,41 @@ func TestConvertJekyllMetadata(t *testing.T) { draft bool expect string }{ - {map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, - `{"date":"2015-10-01T00:00:00Z"}`}, - {map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true, - `{"date":"2015-10-01T00:00:00Z","draft":true}`}, - {map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"}, + { + map[interface{}]interface{}{}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, - `{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`}, - {map[interface{}]interface{}{"permalink": "/permalink.html"}, + `{"date":"2015-10-01T00:00:00Z"}`, + }, + { + map[interface{}]interface{}{}, + "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), true, + `{"date":"2015-10-01T00:00:00Z","draft":true}`, + }, + { + map[interface{}]interface{}{"Permalink": "/permalink.html", "layout": "post"}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, - `{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`}, - {map[interface{}]interface{}{"category": nil, "permalink": 123}, + `{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`, + }, + { + map[interface{}]interface{}{"permalink": "/permalink.html"}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, - `{"date":"2015-10-01T00:00:00Z"}`}, - {map[interface{}]interface{}{"Excerpt_Separator": "sep"}, + `{"date":"2015-10-01T00:00:00Z","url":"/permalink.html"}`, + }, + { + map[interface{}]interface{}{"category": nil, "permalink": 123}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, - `{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep"}`}, - {map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"}, + `{"date":"2015-10-01T00:00:00Z"}`, + }, + { + map[interface{}]interface{}{"Excerpt_Separator": "sep"}, "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, - `{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z"}`}, + `{"date":"2015-10-01T00:00:00Z","excerpt_separator":"sep"}`, + }, + { + map[interface{}]interface{}{"category": "book", "layout": "post", "Others": "Goods", "Date": "2015-10-01 12:13:11"}, + "testPost", time.Date(2015, 10, 1, 0, 0, 0, 0, time.UTC), false, + `{"Others":"Goods","categories":["book"],"date":"2015-10-01T12:13:11Z"}`, + }, } for _, data := range testDataList { @@ -90,44 +106,68 @@ func TestConvertJekyllContent(t *testing.T) { content string expect string }{ - {map[interface{}]interface{}{}, - "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"}, - {map[interface{}]interface{}{"excerpt_separator": "<!--sep-->"}, + { + map[interface{}]interface{}{}, + "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", + }, + { + map[interface{}]interface{}{"excerpt_separator": "<!--sep-->"}, "Test content\n<!--sep-->\npart2 content", - "---\nexcerpt_separator: <!--sep-->\n---\nTest content\n<!--more-->\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{}{}, + { + map[interface{}]interface{}{}, "{% highlight go %}\nvar s int\n{% endhighlight %}", - "{{< highlight go >}}\nvar s int\n{{< / highlight >}}"}, - {map[interface{}]interface{}{}, + "{{< highlight go >}}\nvar s int\n{{< / highlight >}}", + }, + { + map[interface{}]interface{}{}, "{% highlight go linenos hl_lines=\"1 2\" %}\nvar s string\nvar i int\n{% endhighlight %}", - "{{< highlight go \"linenos=table,hl_lines=1 2\" >}}\nvar s string\nvar i int\n{{< / highlight >}}"}, + "{{< highlight go \"linenos=table,hl_lines=1 2\" >}}\nvar s string\nvar i int\n{{< / highlight >}}", + }, // Octopress image tag - {map[interface{}]interface{}{}, + { + map[interface{}]interface{}{}, "{% img http://placekitten.com/890/280 %}", - "{{< figure src=\"http://placekitten.com/890/280\" >}}"}, - {map[interface{}]interface{}{}, + "{{< figure src=\"http://placekitten.com/890/280\" >}}", + }, + { + map[interface{}]interface{}{}, "{% img left http://placekitten.com/320/250 Place Kitten #2 %}", - "{{< figure class=\"left\" src=\"http://placekitten.com/320/250\" title=\"Place Kitten #2\" >}}"}, - {map[interface{}]interface{}{}, + "{{< figure class=\"left\" src=\"http://placekitten.com/320/250\" title=\"Place Kitten #2\" >}}", + }, + { + map[interface{}]interface{}{}, "{% img right http://placekitten.com/300/500 150 250 'Place Kitten #3' %}", - "{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #3\" >}}"}, - {map[interface{}]interface{}{}, + "{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #3\" >}}", + }, + { + map[interface{}]interface{}{}, "{% img right http://placekitten.com/300/500 150 250 'Place Kitten #4' 'An image of a very cute kitten' %}", - "{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}"}, - {map[interface{}]interface{}{}, + "{{< figure class=\"right\" src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}", + }, + { + map[interface{}]interface{}{}, "{% img http://placekitten.com/300/500 150 250 'Place Kitten #4' 'An image of a very cute kitten' %}", - "{{< figure src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}"}, - {map[interface{}]interface{}{}, + "{{< figure src=\"http://placekitten.com/300/500\" width=\"150\" height=\"250\" title=\"Place Kitten #4\" alt=\"An image of a very cute kitten\" >}}", + }, + { + 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"}, + "{{< 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"}, + "---\nDate: \"2015-10-01 12:13:11\"\ncategory: book\nlayout: post\n---\nsomecontent", + }, } for _, data := range testDataList { result, err := convertJekyllContent(data.metadata, data.content) |