package htesting

import "github.com/gohugoio/hugo/htesting"

Index

Variables

var Rnd = rand.New(rand.NewSource(time.Now().UnixNano()))

Rnd is used only for testing.

Functions

func BailOut

func BailOut(after time.Duration)

BailOut panics with a stack trace after the given duration. Useful for hanging tests.

func CreateTempDir

func CreateTempDir(fs afero.Fs, prefix string) (string, func(), error)

CreateTempDir creates a temp dir in the given filesystem and returns the dirnam and a func that removes it when done.

func DiffStringSlices

func DiffStringSlices(slice1 []string, slice2 []string) []string

DiffStringSlices returns the difference between two string slices. Useful in tests. See: http://stackoverflow.com/questions/19374219/how-to-find-the-difference-between-two-slices-of-strings-in-golang

func DiffStrings

func DiffStrings(s1, s2 string) []string

DiffStrings splits the strings into fields and runs it into DiffStringSlices. Useful for tests.

func IsCI

func IsCI() bool

IsCI reports whether we're running in a CI server.

func IsGitHubAction

func IsGitHubAction() bool

IsGitHubAction reports whether we're running in a GitHub Action.

func NewTestdataBuilder

func NewTestdataBuilder(fs afero.Fs, workingDir string, t testing.TB) *testdataBuilder

func RandBool

func RandBool() bool

func SupportsAll

func SupportsAll() bool

SupportsAll reports whether the running system supports all Hugo features, e.g. Asciidoc, Pandoc etc.

Source Files

test_helpers.go testdata_builder.go

Directories

PathSynopsis
htesting/hqt
Version
v0.84.0
Published
Jun 18, 2021
Platform
linux/amd64
Imports
8 packages
Last checked
3 hours ago

Tools for package owners.