mocktest

package
v1.49.0 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyCLI added in v1.41.0

func CopyCLI(t *testing.T, destination string)

CopyCLI gives a test a private executable while RunTests owns compilation. The destination must not exist; its parent should belong to the caller.

func RunTests added in v1.39.0

func RunTests(m *testing.M) (code int)

RunTests owns one lazily built CLI for a package's tests. Each invocation still runs in a fresh process; only compilation is shared. Call it from TestMain.

func TestFile

func TestFile(t *testing.T, contents string) string

func TestRunMockTestWithFlags

func TestRunMockTestWithFlags(t *testing.T, args ...string)

TestRunMockTestWithFlags runs a test against a mock server with the provided CLI args and ensures it succeeds

func TestRunMockTestWithPipeAndFlags

func TestRunMockTestWithPipeAndFlags(t *testing.T, pipeData []byte, args ...string)

TestRunMockTestWithPipeAndFlags runs a test against a mock server with the provided data piped over stdin and CLI args and ensures it succeeds

Types

type OnlyMockServerDialer

type OnlyMockServerDialer struct{}

OnlyMockServerDialer only allows network connections to the mock server

func (*OnlyMockServerDialer) DialContext

func (d *OnlyMockServerDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

Jump to

Keyboard shortcuts

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