testutil

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureStdout

func CaptureStdout(t *testing.T, testFunc func()) *os.File

CaptureStdout captures and returns an os.File that contains all content written to stdout during the provided test function stdout is returned to normal after this function

func GetTCPPort

func GetTCPPort(conn *net.TCPListener) uint16

func GetUDPPort

func GetUDPPort(conn *net.UDPConn) uint16

func TakesAtleast

func TakesAtleast(t *testing.T, duration time.Duration, testFunc func())

TakesAtleast asserts that the provided func thats atleast the provided duration or longer to complete

func WithBytesInStdIn

func WithBytesInStdIn(t *testing.T, bytes []byte, testFunc func())

WithBytesInStdIn pre-load stdin with the provided bytes before running the provided test reverts std in after the test is complete

func WithTempFile

func WithTempFile(t *testing.T, testFunc func(string))

WithTempFile helper function to create a temp file before calling a method that accepts the temp file name the temp file is removed after this function finishes

Types

This section is empty.

Jump to

Keyboard shortcuts

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