aboutsummaryrefslogtreecommitdiffstats
path: root/community/hugo/0001-Remove-git-tests.patch
diff options
context:
space:
mode:
authorLeo <thinkabit.ukim@gmail.com>2019-08-31 22:11:39 -0300
committerLeo <thinkabit.ukim@gmail.com>2019-09-01 10:13:13 -0300
commit1ff7b506b268a0d0957f3ebedd567edbf0908842 (patch)
treea4d743955aa54572801fdf636efe1d9382dbf505 /community/hugo/0001-Remove-git-tests.patch
parent122b741869a5e377ae8cae1a857414a923f81b2f (diff)
downloadaports-1ff7b506b268a0d0957f3ebedd567edbf0908842.tar.bz2
aports-1ff7b506b268a0d0957f3ebedd567edbf0908842.tar.xz
community/hugo: upgrade to 0.57.2
Diffstat (limited to 'community/hugo/0001-Remove-git-tests.patch')
-rw-r--r--community/hugo/0001-Remove-git-tests.patch154
1 files changed, 110 insertions, 44 deletions
diff --git a/community/hugo/0001-Remove-git-tests.patch b/community/hugo/0001-Remove-git-tests.patch
index f786271179..1d1076bea9 100644
--- a/community/hugo/0001-Remove-git-tests.patch
+++ b/community/hugo/0001-Remove-git-tests.patch
@@ -1,14 +1,16 @@
+diff --git a/hugolib/page_test.go b/hugolib/page_test.go
+index 6cf03b8..8e5ae96 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
-@@ -16,7 +16,6 @@
+@@ -16,7 +16,6 @@ package hugolib
import (
"fmt"
"html/template"
- "os"
- "github.com/gohugoio/hugo/common/loggers"
+ "github.com/gohugoio/hugo/config"
-@@ -25,12 +24,9 @@
+@@ -27,11 +26,8 @@ import (
"testing"
"time"
@@ -16,25 +18,25 @@
-
"github.com/gohugoio/hugo/resources/page"
"github.com/gohugoio/hugo/resources/resource"
-
- "github.com/spf13/afero"
"github.com/spf13/viper"
- "github.com/gohugoio/hugo/deps"
-@@ -760,63 +756,6 @@
- d, _ := time.Parse(time.RFC3339, "2013-05-17T16:59:30Z")
-
+ qt "github.com/frankban/quicktest"
+@@ -772,127 +768,6 @@ func TestPageWithDate(t *testing.T) {
checkPageDate(t, p, d)
--}
--
+ }
+
-func TestPageWithLastmodFromGitInfo(t *testing.T) {
-- assrt := require.New(t)
+- c := qt.New(t)
-
- // We need to use the OS fs for this.
- cfg := viper.New()
- fs := hugofs.NewFrom(hugofs.Os, cfg)
- fs.Destination = &afero.MemMapFs{}
-
+- wd, err := os.Getwd()
+- c.Assert(err, qt.IsNil)
+-
- cfg.Set("frontmatter", map[string]interface{}{
- "lastmod": []string{":git", "lastmod"},
- })
@@ -56,41 +58,104 @@
- cfg.Set("languages", langConfig)
- cfg.Set("enableGitInfo", true)
-
-- assrt.NoError(loadDefaultSettingsFor(cfg))
-- assrt.NoError(loadLanguageSettings(cfg, nil))
--
-- wd, err := os.Getwd()
-- assrt.NoError(err)
- cfg.Set("workingDir", filepath.Join(wd, "testsite"))
-
-- h, err := NewHugoSites(deps.DepsCfg{Fs: fs, Cfg: cfg})
+- b := newTestSitesBuilderFromDepsCfg(t, deps.DepsCfg{Fs: fs, Cfg: cfg}).WithNothingAdded()
-
-- assrt.NoError(err)
-- assrt.Len(h.Sites, 2)
+- b.Build(BuildCfg{SkipRender: true})
+- h := b.H
-
-- require.NoError(t, h.Build(BuildCfg{SkipRender: true}))
+- c.Assert(len(h.Sites), qt.Equals, 2)
-
- enSite := h.Sites[0]
-- assrt.Len(enSite.RegularPages(), 1)
+- c.Assert(len(enSite.RegularPages()), qt.Equals, 1)
-
- // 2018-03-11 is the Git author date for testsite/content/first-post.md
-- assrt.Equal("2018-03-11", enSite.RegularPages()[0].Lastmod().Format("2006-01-02"))
+- c.Assert(enSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-03-11")
-
- nnSite := h.Sites[1]
-- assrt.Len(nnSite.RegularPages(), 1)
+- c.Assert(len(nnSite.RegularPages()), qt.Equals, 1)
-
- // 2018-08-11 is the Git author date for testsite/content_nn/first-post.md
-- assrt.Equal("2018-08-11", nnSite.RegularPages()[0].Lastmod().Format("2006-01-02"))
+- c.Assert(nnSite.RegularPages()[0].Lastmod().Format("2006-01-02"), qt.Equals, "2018-08-11")
-
- }
-
- func TestPageWithFrontMatterConfig(t *testing.T) {
+-}
+-
+-func TestPageWithFrontMatterConfig(t *testing.T) {
+- for _, dateHandler := range []string{":filename", ":fileModTime"} {
+- dateHandler := dateHandler
+- t.Run(fmt.Sprintf("dateHandler=%q", dateHandler), func(t *testing.T) {
+- t.Parallel()
+- c := qt.New(t)
+- cfg, fs := newTestCfg()
+-
+- pageTemplate := `
+----
+-title: Page
+-weight: %d
+-lastMod: 2018-02-28
+-%s
+----
+-Content
+-`
+-
+- cfg.Set("frontmatter", map[string]interface{}{
+- "date": []string{dateHandler, "date"},
+- })
+-
+- c1 := filepath.Join("content", "section", "2012-02-21-noslug.md")
+- c2 := filepath.Join("content", "section", "2012-02-22-slug.md")
+-
+- writeSource(t, fs, c1, fmt.Sprintf(pageTemplate, 1, ""))
+- writeSource(t, fs, c2, fmt.Sprintf(pageTemplate, 2, "slug: aslug"))
+-
+- c1fi, err := fs.Source.Stat(c1)
+- c.Assert(err, qt.IsNil)
+- c2fi, err := fs.Source.Stat(c2)
+- c.Assert(err, qt.IsNil)
+-
+- b := newTestSitesBuilderFromDepsCfg(t, deps.DepsCfg{Fs: fs, Cfg: cfg}).WithNothingAdded()
+- b.Build(BuildCfg{SkipRender: true})
+-
+- s := b.H.Sites[0]
+- c.Assert(len(s.RegularPages()), qt.Equals, 2)
+-
+- noSlug := s.RegularPages()[0]
+- slug := s.RegularPages()[1]
+-
+- c.Assert(noSlug.Lastmod().Day(), qt.Equals, 28)
+-
+- switch strings.ToLower(dateHandler) {
+- case ":filename":
+- c.Assert(noSlug.Date().IsZero(), qt.Equals, false)
+- c.Assert(slug.Date().IsZero(), qt.Equals, false)
+- c.Assert(noSlug.Date().Year(), qt.Equals, 2012)
+- c.Assert(slug.Date().Year(), qt.Equals, 2012)
+- c.Assert(noSlug.Slug(), qt.Equals, "noslug")
+- c.Assert(slug.Slug(), qt.Equals, "aslug")
+- case ":filemodtime":
+- c.Assert(noSlug.Date().Year(), qt.Equals, c1fi.ModTime().Year())
+- c.Assert(slug.Date().Year(), qt.Equals, c2fi.ModTime().Year())
+- fallthrough
+- default:
+- c.Assert(noSlug.Slug(), qt.Equals, "")
+- c.Assert(slug.Slug(), qt.Equals, "aslug")
+-
+- }
+- })
+- }
+-
+-}
+-
+ func TestWordCountWithAllCJKRunesWithoutHasCJKLanguage(t *testing.T) {
+ t.Parallel()
+ assertFunc := func(t *testing.T, ext string, pages page.Pages) {
diff --git a/releaser/git_test.go b/releaser/git_test.go
deleted file mode 100644
-index f0d6fd24..00000000
+index 1c5f788..0000000
--- a/releaser/git_test.go
+++ /dev/null
-@@ -1,75 +0,0 @@
+@@ -1,78 +0,0 @@
-// Copyright 2017-present The Hugo Authors. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
@@ -109,19 +174,20 @@ index f0d6fd24..00000000
-import (
- "testing"
-
-- "github.com/stretchr/testify/require"
+- qt "github.com/frankban/quicktest"
-)
-
-func TestGitInfos(t *testing.T) {
+- c := qt.New(t)
- skipIfCI(t)
- infos, err := getGitInfos("v0.20", "hugo", "", false)
-
-- require.NoError(t, err)
-- require.True(t, len(infos) > 0)
--
+- c.Assert(err, qt.IsNil)
+- c.Assert(len(infos) > 0, qt.Equals, true)
-}
-
-func TestIssuesRe(t *testing.T) {
+- c := qt.New(t)
-
- body := `
-This is a commit message.
@@ -134,28 +200,30 @@ index f0d6fd24..00000000
-
- issues := extractIssues(body)
-
-- require.Len(t, issues, 4)
-- require.Equal(t, 123, issues[0])
-- require.Equal(t, 543, issues[2])
+- c.Assert(len(issues), qt.Equals, 4)
+- c.Assert(issues[0], qt.Equals, 123)
+- c.Assert(issues[2], qt.Equals, 543)
-
-}
-
-func TestGitVersionTagBefore(t *testing.T) {
- skipIfCI(t)
+- c := qt.New(t)
- v1, err := gitVersionTagBefore("v0.18")
-- require.NoError(t, err)
-- require.Equal(t, "v0.17", v1)
+- c.Assert(err, qt.IsNil)
+- c.Assert(v1, qt.Equals, "v0.17")
-}
-
-func TestTagExists(t *testing.T) {
- skipIfCI(t)
+- c := qt.New(t)
- b1, err := tagExists("v0.18")
-- require.NoError(t, err)
-- require.True(t, b1)
+- c.Assert(err, qt.IsNil)
+- c.Assert(b1, qt.Equals, true)
-
- b2, err := tagExists("adfagdsfg")
-- require.NoError(t, err)
-- require.False(t, b2)
+- c.Assert(err, qt.IsNil)
+- c.Assert(b2, qt.Equals, false)
-
-}
-
@@ -166,6 +234,4 @@ index f0d6fd24..00000000
- t.Skip("Skip git test on Linux to make Travis happy.")
- }
-}
---
-2.21.0