testing

package
v0.0.34 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func List added in v0.0.31

func List(fsys afero.Fs, path string) (iter.Seq[*Test], error)

func MediaTypeEntries

func MediaTypeEntries() []ginkgo.TableEntry

func MockOsStdin added in v0.0.31

func MockOsStdin(reader io.Reader) tdl.Stdin

func MockTermStdin added in v0.0.31

func MockTermStdin() tdl.Stdin

func NewGitHubClient

func NewGitHubClient() *github.Client

Types

type Cache

type Cache struct {
	GetFunc    func(string) (*tdl.CacheItem, error)
	WriterFunc func(string) (io.WriteCloser, error)
}

func NewCacheFrom added in v0.0.33

func NewCacheFrom(cache tdl.Cache) *Cache

func NewTmpCache added in v0.0.33

func NewTmpCache(t ginkgo.GinkgoTInterface) (*Cache, string)

func (*Cache) Get added in v0.0.33

func (c *Cache) Get(key string) (*tdl.CacheItem, error)

func (*Cache) Writer added in v0.0.33

func (c *Cache) Writer(key string) (io.WriteCloser, error)

type MockFileInfo added in v0.0.31

type MockFileInfo struct {
	IsDirFn   func() bool
	ModTimeFn func() time.Time
	ModeFn    func() fs.FileMode
	NameFn    func() string
	SizeFn    func() int64
	SysFn     func() any
}

func (MockFileInfo) IsDir added in v0.0.31

func (f MockFileInfo) IsDir() bool

IsDir implements fs.FileInfo.

func (MockFileInfo) ModTime added in v0.0.31

func (f MockFileInfo) ModTime() time.Time

ModTime implements fs.FileInfo.

func (MockFileInfo) Mode added in v0.0.31

func (f MockFileInfo) Mode() fs.FileMode

Mode implements fs.FileInfo.

func (MockFileInfo) Name added in v0.0.31

func (f MockFileInfo) Name() string

Name implements fs.FileInfo.

func (MockFileInfo) Size added in v0.0.31

func (f MockFileInfo) Size() int64

Size implements fs.FileInfo.

func (MockFileInfo) Sys added in v0.0.31

func (f MockFileInfo) Sys() any

Sys implements fs.FileInfo.

type MockGenerator

type MockGenerator struct {
	ExecuteFunc func(context.Context, *tdlv1alpha1.Spec) (afero.Fs, error)
	StringFunc  func() string
}

func (*MockGenerator) Execute

func (m *MockGenerator) Execute(
	ctx context.Context,
	spec *tdlv1alpha1.Spec,
) (afero.Fs, error)

Execute implements tdl.Generator.

func (*MockGenerator) String added in v0.0.32

func (m *MockGenerator) String() string

String implements tdl.Generator.

func (*MockGenerator) WithExecute

func (m *MockGenerator) WithExecute(
	fn func(context.Context, *tdlv1alpha1.Spec) (afero.Fs, error),
) *MockGenerator

func (*MockGenerator) WithName

func (m *MockGenerator) WithName(name string) *MockGenerator

func (*MockGenerator) WithString

func (m *MockGenerator) WithString(
	fn func() string,
) *MockGenerator

type MockOs added in v0.0.31

type MockOs struct {
	FsValue     afero.Fs
	StderrValue io.Writer
	StdoutValue io.Writer
	StdinValue  tdl.Stdin
}

func (*MockOs) Fs added in v0.0.31

func (m *MockOs) Fs() afero.Fs

Fs implements tdl.OS.

func (*MockOs) Stderr added in v0.0.31

func (m *MockOs) Stderr() io.Writer

Stderr implements tdl.OS.

func (*MockOs) Stdin added in v0.0.31

func (m *MockOs) Stdin() tdl.Stdin

Stdin implements tdl.OS.

func (*MockOs) Stdout added in v0.0.31

func (m *MockOs) Stdout() io.Writer

Stdout implements tdl.OS.

type MockPlugin

type MockPlugin struct {
	GeneratorFunc func(context.Context, tdl.Meta) (tdl.Generator, error)
	ToolFunc      func(context.Context, tdl.Meta) (tdl.Tool, error)
	SupportsFunc  func(tdl.Target) bool
	MetaValue     tdl.Meta
	StringFunc    func() string
	PrepareFunc   func(context.Context) error
}

func (*MockPlugin) Generator

func (p *MockPlugin) Generator(ctx context.Context, m tdl.Meta) (tdl.Generator, error)

Generator implements tdl.Plugin.

func (*MockPlugin) Meta added in v0.0.33

func (m *MockPlugin) Meta() tdl.Meta

Meta implements tdl.GeneratorPlugin.

func (*MockPlugin) Prepare added in v0.0.33

func (p *MockPlugin) Prepare(ctx context.Context) error

String implements tdl.Plugin.

func (*MockPlugin) String

func (p *MockPlugin) String() string

String implements tdl.Plugin.

func (*MockPlugin) Supports added in v0.0.33

func (p *MockPlugin) Supports(target tdl.Target) bool

func (*MockPlugin) Tool added in v0.0.33

func (p *MockPlugin) Tool(ctx context.Context, m tdl.Meta) (tdl.Tool, error)

Tool implements tdl.ToolPlugin.

func (*MockPlugin) WithGenerator

func (p *MockPlugin) WithGenerator(
	fn func(context.Context, tdl.Meta) (tdl.Generator, error),
) *MockPlugin

func (*MockPlugin) WithString

func (m *MockPlugin) WithString(
	fn func() string,
) *MockPlugin

type MockTarget

type MockTarget struct {
	ChooseFunc func(iter.Seq[tdl.Plugin]) (tdl.Plugin, error)
	MetaFunc   func() tdl.Meta
	StringFunc func() string
}

func (*MockTarget) Choose

func (m *MockTarget) Choose(available iter.Seq[tdl.Plugin]) (tdl.Plugin, error)

Tool implements tdl.Target.

func (*MockTarget) Meta added in v0.0.33

func (m *MockTarget) Meta() tdl.Meta

Meta implements tdl.Target.

func (*MockTarget) String

func (m *MockTarget) String() string

String implements tdl.Target.

func (*MockTarget) WithGenerator added in v0.0.32

func (m *MockTarget) WithGenerator(
	fn func(iter.Seq[tdl.Plugin]) (tdl.Plugin, error),
) *MockTarget

func (*MockTarget) WithString

func (m *MockTarget) WithString(
	fn func() string,
) *MockTarget

type RawTest added in v0.0.31

type RawTest struct {
	Name   string
	Input  []byte
	Output []byte
}

func Discover

func Discover(fsys afero.Fs, root string) ([]*RawTest, error)

func ReadRawTest added in v0.0.31

func ReadRawTest(fsys afero.Fs, root string) (*RawTest, error)

ReadRawTest attempts to read a valid Test from root. A valid test is defined as a directory that contains an input.* file and a output.* file.

type Test

type Test struct {
	Name     string
	Spec     *tdlv1alpha1.Spec
	Expected afero.Fs
}

func ReadTest

func ReadTest(fsys afero.Fs, name, path string) (*Test, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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