diff options
author | Bjørn Erik Pedersen <[email protected]> | 2023-01-04 18:24:36 +0100 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2023-05-16 18:01:29 +0200 |
commit | 241b21b0fd34d91fccb2ce69874110dceae6f926 (patch) | |
tree | d4e0118eac7e9c42f065815447a70805f8d6ad3e /hugolib/pagecollections_test.go | |
parent | 6aededf6b42011c3039f5f66487a89a8dd65e0e7 (diff) | |
download | hugo-241b21b0fd34d91fccb2ce69874110dceae6f926.tar.gz hugo-241b21b0fd34d91fccb2ce69874110dceae6f926.zip |
Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code.
Also,
* Lower case the default output format names; this is in line with the custom ones (map keys) and how
it's treated all the places. This avoids doing `stringds.EqualFold` everywhere.
Closes #10896
Closes #10620
Diffstat (limited to 'hugolib/pagecollections_test.go')
-rw-r--r-- | hugolib/pagecollections_test.go | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/hugolib/pagecollections_test.go b/hugolib/pagecollections_test.go index d664b7f4e..abdfb9619 100644 --- a/hugolib/pagecollections_test.go +++ b/hugolib/pagecollections_test.go @@ -41,13 +41,18 @@ func BenchmarkGetPage(b *testing.B) { r = rand.New(rand.NewSource(time.Now().UnixNano())) ) + configs, err := loadTestConfigFromProvider(cfg) + if err != nil { + b.Fatal(err) + } + for i := 0; i < 10; i++ { for j := 0; j < 100; j++ { writeSource(b, fs, filepath.Join("content", fmt.Sprintf("sect%d", i), fmt.Sprintf("page%d.md", j)), "CONTENT") } } - s := buildSingleSite(b, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) + s := buildSingleSite(b, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true}) pagePaths := make([]string, b.N) @@ -76,6 +81,11 @@ func createGetPageRegularBenchmarkSite(t testing.TB) *Site { cfg, fs = newTestCfg() ) + configs, err := loadTestConfigFromProvider(cfg) + if err != nil { + t.Fatal(err) + } + pc := func(title string) string { return fmt.Sprintf(pageCollectionsPageTemplate, title) } @@ -87,7 +97,7 @@ func createGetPageRegularBenchmarkSite(t testing.TB) *Site { } } - return buildSingleSite(c, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) + return buildSingleSite(c, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true}) } func TestBenchmarkGetPageRegular(t *testing.T) { @@ -174,6 +184,9 @@ func TestGetPage(t *testing.T) { c = qt.New(t) ) + configs, err := loadTestConfigFromProvider(cfg) + c.Assert(err, qt.IsNil) + pc := func(title string) string { return fmt.Sprintf(pageCollectionsPageTemplate, title) } @@ -210,7 +223,7 @@ func TestGetPage(t *testing.T) { writeSource(t, fs, filepath.Join("content", "section_bundle_overlap", "_index.md"), pc("index overlap section")) writeSource(t, fs, filepath.Join("content", "section_bundle_overlap_bundle", "index.md"), pc("index overlap bundle")) - s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Cfg: cfg}, BuildCfg{SkipRender: true}) + s := buildSingleSite(t, deps.DepsCfg{Fs: fs, Configs: configs}, BuildCfg{SkipRender: true}) sec3, err := s.getPageNew(nil, "/sect3") c.Assert(err, qt.IsNil) @@ -294,7 +307,7 @@ func TestGetPage(t *testing.T) { if test.context == nil { for _, ref := range test.pathVariants { args := append([]string{test.kind}, ref) - page, err := s.Info.GetPage(args...) + page, err := s.GetPage(args...) test.check(page, err, errorMsg, c) } } |