testutil

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestReader

func TestReader(t *TestRunner, factory ReaderFactory)

TestReader tests Reader returns correct file metadata.

Types

type ReaderFactory

type ReaderFactory func(sr *io.SectionReader, opts ...metadata.Option) (r TestableReader, err error)

type Runner added in v0.18.0

type Runner func(t TestingT, name string, fn func(t TestingT))

Runner allows running subtests of TestingT. This exists instead of adding a Run method to TestingT interface because the Run implementation of testing.T would not satisfy the interface.

type TestRunner added in v0.18.0

type TestRunner struct {
	TestingT
	Runner Runner
}

func (*TestRunner) Run added in v0.18.0

func (r *TestRunner) Run(name string, run func(*TestRunner))

type TestableReader

type TestableReader interface {
	metadata.Reader
	NumOfNodes() (i int, _ error)
}

type TestingT added in v0.18.0

type TestingT interface {
	Errorf(format string, args ...any)
	Fatal(args ...any)
	Fatalf(format string, args ...any)
	Logf(format string, args ...any)
}

TestingT is the minimal set of testing.T required to run the tests defined in TestReader. This interface exists to prevent leaking the testing package from being exposed outside tests.

Jump to

Keyboard shortcuts

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