summaryrefslogtreecommitdiffhomepage
path: root/hugolib/testhelpers_test.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2019-03-24 10:11:16 +0100
committerBjørn Erik Pedersen <[email protected]>2019-03-24 16:14:51 +0100
commitb5f39d23b86f9cb83c51da9fe4abb4c19c01c3b7 (patch)
treecf23180dc07698391cf47c2fe525755417729020 /hugolib/testhelpers_test.go
parent3011f36c27ecde309325e6c75ca377f4f87fa97a (diff)
downloadhugo-b5f39d23b86f9cb83c51da9fe4abb4c19c01c3b7.tar.gz
hugo-b5f39d23b86f9cb83c51da9fe4abb4c19c01c3b7.zip
all: Apply staticcheck recommendations
Diffstat (limited to 'hugolib/testhelpers_test.go')
-rw-r--r--hugolib/testhelpers_test.go24
1 files changed, 16 insertions, 8 deletions
diff --git a/hugolib/testhelpers_test.go b/hugolib/testhelpers_test.go
index 7de2280c7..0a8fbe7f5 100644
--- a/hugolib/testhelpers_test.go
+++ b/hugolib/testhelpers_test.go
@@ -20,6 +20,7 @@ import (
"github.com/gohugoio/hugo/resources/page"
"github.com/sanity-io/litter"
"github.com/spf13/afero"
+ "github.com/spf13/cast"
"github.com/gohugoio/hugo/helpers"
"github.com/gohugoio/hugo/tpl"
@@ -27,6 +28,8 @@ import (
"os"
+ "github.com/gohugoio/hugo/resources/resource"
+
"github.com/gohugoio/hugo/common/loggers"
"github.com/gohugoio/hugo/hugofs"
"github.com/stretchr/testify/assert"
@@ -672,6 +675,19 @@ func getPage(in page.Page, ref string) page.Page {
return p
}
+func content(c resource.ContentProvider) string {
+ cc, err := c.Content()
+ if err != nil {
+ panic(err)
+ }
+
+ ccs, err := cast.ToStringE(cc)
+ if err != nil {
+ panic(err)
+ }
+ return ccs
+}
+
func dumpPages(pages ...page.Page) {
fmt.Println("---------")
for i, p := range pages {
@@ -726,11 +742,3 @@ func parallel(t *testing.T) {
t.Parallel()
}
}
-
-// Useful to debug nilpointers/panics in templates.
-// Put "defer recoverStack()" in top of the failing function.
-func recoverStack() {
- if r := recover(); r != nil {
- fmt.Println(printStackTrace(1000))
- }
-}