runner

package
v0.2.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package runner executes test.Test values under Go's native test framework and other test frameworks with a similar interface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlessAvailable added in v0.2.4

type BlessAvailable struct {
	PackagePath string
}

BlessAvailable is a BlessStrategy that instructs the user that blessing may be activated by using the -aureus.bless flag on the command line.

type BlessDisabled added in v0.2.4

type BlessDisabled struct{}

BlessDisabled is a BlessStrategy that explicitly disables blessing of failed tests.

It implies that the -aureus.bless flag on the command line is ignored.

type BlessEnabled added in v0.2.4

type BlessEnabled struct{}

BlessEnabled is a BlessStrategy that explicitly enables blessing of failed tests.

type BlessStrategy added in v0.2.4

type BlessStrategy interface {
	// contains filtered or unexported methods
}

BlessStrategy is a strategy for blessing failed tests.

type Input added in v0.2.0

type Input interface {
	io.Reader

	// Language returns the language of the input value, if known, e.g. "json",
	// "yaml", etc.
	Language() string

	// Attributes returns a set of key-value pairs that provide additional
	// loader-specific information about the input.
	Attributes() map[string]string
}

Input is an interface for the input to a test.

type LoggerT added in v0.2.4

type LoggerT interface {
	Helper()
	Name() string
	Log(...any)
}

LoggerT is the subset of the testing.TB that supports logging only.

type Output added in v0.2.0

type Output interface {
	io.Writer

	// Language returns the expected language of the output value, if known,
	// e.g. "json", "yaml", etc.
	Language() string

	// Attributes returns a set of key-value pairs that provide additional
	// loader-specific information about the expected output.
	Attributes() map[string]string
}

Output is an interface for producing the output for a test.

type OutputGenerator

type OutputGenerator[T TestingT[T]] func(T, Input, Output) error

OutputGenerator produces the output of a specific test.

type Runner

type Runner[T TestingT[T]] struct {
	GenerateOutput OutputGenerator[T]
	TrimSpace      bool // TODO: make this a loader concern
	BlessStrategy  BlessStrategy
}

Runner executes tests under any test framework with an interface similar to Go's native *testing.T.

func (*Runner[T]) Run

func (r *Runner[T]) Run(t T, x test.Test)

Run makes the assertions described by all documents within a [TestSuite].

type TestingT

type TestingT[T any] interface {
	LoggerT

	SkipNow()
	Fail()
	Failed() bool
	Run(string, func(T)) bool
}

TestingT is a constraint for types that are compatible with testing.T.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL