summaryrefslogtreecommitdiffstats
path: root/hugolib/pagebundler_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-02 13:23:25 +0100
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2020-12-03 13:12:58 +0100
commitd90e37e0c6e812f9913bf256c9c81aa05b7a08aa (patch)
tree7b1b14464eefec1188ca2eed53c64e4823453cc9 /hugolib/pagebundler_test.go
parent32471b57bde51c55a15dbf1db75d6e5f7232c347 (diff)
all: Format code with gofumpt
See https://github.com/mvdan/gofumpt
Diffstat (limited to 'hugolib/pagebundler_test.go')
-rw-r--r--hugolib/pagebundler_test.go29
1 files changed, 5 insertions, 24 deletions
diff --git a/hugolib/pagebundler_test.go b/hugolib/pagebundler_test.go
index fa420a025..8f9459564 100644
--- a/hugolib/pagebundler_test.go
+++ b/hugolib/pagebundler_test.go
@@ -14,8 +14,11 @@
package hugolib
import (
+ "fmt"
+ "io"
"os"
"path"
+ "path/filepath"
"regexp"
"strings"
"testing"
@@ -29,16 +32,10 @@ import (
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/resources/page"
- "io"
-
"github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/media"
- "path/filepath"
-
- "fmt"
-
"github.com/gohugoio/hugo/deps"
"github.com/spf13/viper"
@@ -265,12 +262,10 @@ func TestPageBundlerSiteRegular(t *testing.T) {
b.AssertFileContent(filepath.FromSlash("/work/public/root/index.html"), "Single Title")
}
-
})
}
}
}
-
}
func TestPageBundlerSiteMultilingual(t *testing.T) {
@@ -296,7 +291,7 @@ func TestPageBundlerSiteMultilingual(t *testing.T) {
c.Assert(len(s.RegularPages()), qt.Equals, 8)
c.Assert(len(s.Pages()), qt.Equals, 16)
- //dumpPages(s.AllPages()...)
+ // dumpPages(s.AllPages()...)
c.Assert(len(s.AllPages()), qt.Equals, 31)
bundleWithSubPath := s.getPage(page.KindPage, "lb/index")
@@ -350,7 +345,6 @@ func TestPageBundlerSiteMultilingual(t *testing.T) {
b.AssertFileContent("public/nn/bc/data1.nn.json", "data1.nn")
b.AssertFileContent("public/nn/bc/data2.json", "data2")
b.AssertFileContent("public/nn/bc/logo-bc.png", "logo")
-
})
}
}
@@ -393,7 +387,6 @@ func TestMultilingualDisableLanguage(t *testing.T) {
c.Assert(p.Language().Lang != "nn", qt.Equals, true)
return false
})
-
}
func TestPageBundlerSiteWitSymbolicLinksInContent(t *testing.T) {
@@ -499,7 +492,6 @@ TheContent.
b.AssertFileContent(filepath.FromSlash(workDir+"/public/a/page/index.html"), "TheContent")
b.AssertFileContent(filepath.FromSlash(workDir+"/public/symbolic1/s1/index.html"), "TheContent")
b.AssertFileContent(filepath.FromSlash(workDir+"/public/symbolic2/a1/index.html"), "TheContent")
-
}
func TestPageBundlerHeadless(t *testing.T) {
@@ -583,7 +575,6 @@ HEADLESS {{< myShort >}}
c.Assert(s.RegularPages(), qt.HasLen, 1)
c.Assert(s.home.RegularPages(), qt.HasLen, 1)
c.Assert(s.home.Pages(), qt.HasLen, 1)
-
}
func TestPageBundlerHeadlessIssue6552(t *testing.T) {
@@ -705,7 +696,6 @@ Single content.
b.AssertFileContent("public/section-not-bundle/index.html", "Section Page", "Content: <p>Section content.</p>")
b.AssertFileContent("public/section-not-bundle/single/index.html", "Section Single", "|<p>Single content.</p>")
-
}
func newTestBundleSources(t testing.TB) (*hugofs.Fs, *viper.Viper) {
@@ -873,7 +863,6 @@ Content for 은행.
c.Assert(err, qt.IsNil)
return fs, cfg
-
}
func newTestBundleSourcesMultilingual(t *testing.T) (*hugofs.Fs, *viper.Viper) {
@@ -955,7 +944,7 @@ TheContent.
writeSource(t, fs, filepath.Join(workDir, "base", "lb", "c", "one.png"), "content")
writeSource(t, fs, filepath.Join(workDir, "base", "lb", "c", "d", "deep.png"), "content")
- //Translated bundle in some sensible sub path.
+ // Translated bundle in some sensible sub path.
writeSource(t, fs, filepath.Join(workDir, "base", "bf", "my-bf-bundle", "index.md"), pageContent)
writeSource(t, fs, filepath.Join(workDir, "base", "bf", "my-bf-bundle", "index.nn.md"), pageContent)
writeSource(t, fs, filepath.Join(workDir, "base", "bf", "my-bf-bundle", "page.md"), pageContent)
@@ -994,7 +983,6 @@ date: 2017-01-15
b.Build(BuildCfg{})
b.AssertFileContent("public/mybundle/data.json", "My changed data")
-
}
// https://github.com/gohugoio/hugo/issues/4870
@@ -1023,7 +1011,6 @@ slug: %s
c.Assert(b.CheckExists("public/about/services1/this-is-the-slug/index.html"), qt.Equals, true)
c.Assert(b.CheckExists("public/about/services2/this-is-another-slug/index.html"), qt.Equals, true)
-
}
func TestBundleMisc(t *testing.T) {
@@ -1112,13 +1099,11 @@ slug: leaf
b.AssertFileContentFn("public/en/index.html", func(s string) bool {
// Check ignored files
return !regexp.MustCompile("README|ignore").MatchString(s)
-
})
b.AssertFileContent("public/nn/index.html", filepath.FromSlash("page|sect1/sect2/page.md|CurrentSection: sect1"))
b.AssertFileContentFn("public/nn/index.html", func(s string) bool {
return !strings.Contains(s, "enonly")
-
})
// Check order of inherited data file
@@ -1136,7 +1121,6 @@ slug: leaf
b.AssertFileContent("public/en/b2/index.html",
"/en/b2/leaf/",
filepath.FromSlash("section|sect1/sect2/_index.md|CurrentSection: sect1/sect2/_index.md"))
-
}
// Issue 6136
@@ -1214,7 +1198,6 @@ Num Pages: {{ len .Site.Pages }}
"page|/en/blog/sect2/b1/|Content: s2.b1|Resources: R: data.json|s2.b1.data|",
"page|/en/blog/sect2/b2/|Content: s2.b2|Resources: R: s2.b2.bundlecontent|",
)
-
}
// #6208
@@ -1256,11 +1239,9 @@ title: %q
page|bundle sub index|
page|bundle sub p2|
`)
-
}
func TestBundleTransformMany(t *testing.T) {
-
b := newTestSitesBuilder(t).WithSimpleConfigFile().Running()
for i := 1; i <= 50; i++ {