package htesting
import "github.com/gohugoio/hugo/htesting"
Index ¶
- Variables
- func BailOut(after time.Duration)
- func CreateTempDir(fs afero.Fs, prefix string) (string, func(), error)
- func DiffStringSlices(slice1 []string, slice2 []string) []string
- func DiffStrings(s1, s2 string) []string
- func GoMinorVersion() int
- func IsCI() bool
- func IsGitHubAction() bool
- func IsRealCI() bool
- func IsWindows() bool
- func RandBool() bool
- func SupportsAll() bool
- type PinnedRunner
Variables ¶
var IsTest bool
IsTest reports whether we're running as a test.
Rnd is used only for testing.
Functions ¶
func BailOut ¶
BailOut panics with a stack trace after the given duration. Useful for hanging tests.
func CreateTempDir ¶
CreateTempDir creates a temp dir in the given filesystem and returns the dirname and a func that removes it when done.
func DiffStringSlices ¶
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 ¶
DiffStrings splits the strings into fields and runs it into DiffStringSlices. Useful for tests.
func GoMinorVersion ¶
func GoMinorVersion() int
GoMinorVersion returns the minor version of the current Go version, e.g. 16 for Go 1.16.
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 IsRealCI ¶
func IsRealCI() bool
IsRealCI reports whether we're running in a CI server, but not in a local CI setup.
func IsWindows ¶
func IsWindows() bool
IsWindows reports whether this runs on Windows.
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.
Types ¶
type PinnedRunner ¶
type PinnedRunner struct {
// contains filtered or unexported fields
}
func NewPinnedRunner ¶
func NewPinnedRunner(t testing.TB, pinnedTestRe string) *PinnedRunner
NewPinnedRunner creates a new runner that will only Run tests matching the given regexp. This is added mostly to use in combination with https://marketplace.visualstudio.com/items?itemName=windmilleng.vscode-go-autotest
func (*PinnedRunner) Run ¶
func (r *PinnedRunner) Run(name string, f func(c *qt.C)) bool
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
htesting/hqt |
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 13 hours ago –
Tools for package owners.