gentest

package
v0.0.0-...-35af64f Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package gentest provides internal test utilities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOutput

func CaptureOutput(w io.Writer) func()

CaptureOutput captures the standard logger to the passed writer and returns a rollback function. Typical usage:

var buf bytes.Buffer
defer gentest.CaptureOutput(&buf)()

func DiscardOutput

func DiscardOutput() func()

DiscardOutput discards the standard logger and returns a rollback function.

Typical usage:

defer gentest.DiscardOutput()()

func GoExecInDir

func GoExecInDir(target string, args ...string) func(*testing.T)

GoExecInDir executes a go commands from a target current directory.

It returns a test runner func(*testing.T).

Typical usage:

t.Run("should execute mycommand", gentest.GoExecInDir(folder, args))

Types

This section is empty.

Jump to

Keyboard shortcuts

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