diff options
author | Joe Mooring <[email protected]> | 2024-06-08 06:45:58 -0700 |
---|---|---|
committer | Bjørn Erik Pedersen <[email protected]> | 2024-06-08 18:35:14 +0200 |
commit | cba2de6ec91bc60735600ec068c018d9f53ee5ca (patch) | |
tree | 44fed71260583886ddc0ea2edaaa4c87511152bb /hugolib | |
parent | 9c4e14eb4f890d2a3caad2dcd9209609b7274914 (diff) | |
download | hugo-cba2de6ec91bc60735600ec068c018d9f53ee5ca.tar.gz hugo-cba2de6ec91bc60735600ec068c018d9f53ee5ca.zip |
resources/page: Let GroupByParam return nil instead of error
Closes #12578
Diffstat (limited to 'hugolib')
-rw-r--r-- | hugolib/site_test.go | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/hugolib/site_test.go b/hugolib/site_test.go index 1de1d688a..37546824a 100644 --- a/hugolib/site_test.go +++ b/hugolib/site_test.go @@ -427,8 +427,8 @@ mainSections=["a", "b"] {{/* Behaviour before Hugo 0.112.0. */}} MainSections Params: {{ site.Params.mainSections }}| MainSections Site method: {{ site.MainSections }}| - - + + ` b := Test(t, files) @@ -478,8 +478,8 @@ disableKinds = ['RSS','sitemap','taxonomy','term'] -- layouts/index.html -- MainSections Params: {{ site.Params.mainSections }}| MainSections Site method: {{ site.MainSections }}| - - + + ` b := Test(t, files) @@ -787,9 +787,12 @@ func TestGroupedPages(t *testing.T) { t.Errorf("PageGroup has unexpected number of pages. First group should have '%d' pages, got '%d' pages", 2, len(byparam[0].Pages)) } - _, err = s.RegularPages().GroupByParam("not_exist") - if err == nil { - t.Errorf("GroupByParam didn't return an expected error") + byNonExistentParam, err := s.RegularPages().GroupByParam("not_exist") + if err != nil { + t.Errorf("GroupByParam returned an error when it shouldn't") + } + if len(byNonExistentParam) != 0 { + t.Errorf("PageGroup array has unexpected elements. Group length should be '%d', got '%d'", 0, len(byNonExistentParam)) } byOnlyOneParam, err := s.RegularPages().GroupByParam("only_one") |