tests

package
v0.0.0-...-f3ae026 Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CR = []byte{'\n'}
View Source
var CRLF = []byte{'\r', '\n'}

Functions

func HasCode

func HasCode(c int) resInitFn

func HasItem

func HasItem(it vocab.Item) resInitFn

func Request

func Request(initFn ...reqInitFn) testRequest

func Response

func Response(initFn ...resInitFn) testResponse

func WithBody

func WithBody(r io.Reader) reqInitFn

func WithMethod

func WithMethod(m string) reqInitFn

func WithTests

func WithTests(testFns ...LineOutputTest) ioTestFn

func WithURL

func WithURL(u string) reqInitFn

Types

type CommandTest

type CommandTest struct {
	Name    string
	Host    string
	Cmd     tc.Executable
	IO      ioTestFn
	WantErr error
}

func (CommandTest) Fn

func (c CommandTest) Fn(ctx context.Context, mocks c.Running) func(t *testing.T)

func (CommandTest) Label

func (c CommandTest) Label() string

func (CommandTest) Run

func (c CommandTest) Run(ctx context.Context, mocks c.Running, t *testing.T)

type HTTPTest

type HTTPTest struct {
	Name string
	Req  testRequest
	Res  testResponse
}

func (HTTPTest) Fn

func (pair HTTPTest) Fn(ctx context.Context, mocks c.Running) func(t *testing.T)

func (HTTPTest) Label

func (pair HTTPTest) Label() string

func (HTTPTest) Run

func (pair HTTPTest) Run(ctx context.Context, mocks c.Running, t *testing.T)

type LineOutputTest

type LineOutputTest func(*testing.T, []byte) []byte

type RunnableTest

type RunnableTest interface {
	Label() string
	// Run is one way to run the tests directly from a func(*testing.T)
	Run(context.Context, c.Running, *testing.T)
	// Fn is a way to pass the test fn directly to testing.T.Run()
	Fn(context.Context, c.Running) func(*testing.T)
}

Jump to

Keyboard shortcuts

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