pagr

A 'static site generator', built using dati.
Log | Files | Refs | Atom

commit 36e2d18f125137e15ab3a2261f9f2ac4d468b8ba
parent e8d3bae93d99b45e0240ba7a1d160ff5687585e6
Author: gearsix <gearsix@tuta.io>
Date:   Mon, 14 Mar 2022 22:22:59 +0000

bugfix: fixed nil ptr bug in pagr_test.go

Diffstat:
Mpagr_test.go | 17++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/pagr_test.go b/pagr_test.go @@ -4,7 +4,6 @@ import ( "fmt" "os" "path/filepath" - "strings" "testing" "time" ) @@ -163,11 +162,19 @@ func validateTestPagesNav(t *testing.T, pages []Page) { foundRoot := false foundParent := false for _, pp := range pages { - if !foundRoot && p.Nav.Root.Path == pp.Path { - foundRoot = true + if !foundRoot { + if p.Nav.Root == nil { + foundRoot = true + } else if p.Nav.Root.Path == pp.Path { + foundRoot = true + } } - if !foundParent && p.Nav.Parent == nil || p.Nav.Parent.Path == pp.Path { - foundParent = true + if !foundParent { + if p.Nav.Parent == nil { + foundParent = true + } else if p.Nav.Parent.Path == pp.Path { + foundParent = true + } } if foundRoot && foundParent { break