iotest

Package iotest provides utilities for testing IO-related code.

package iotest

import "go.abhg.dev/doc2go/internal/iotest"

Package iotest provides utilities for testing IO-related code.

Index

Functions

func Writer

func Writer(t testing.TB) io.Writer

Writer builds and returns an io.Writer that writes messages to the given testing.TB. It ensures that each line is logged separately.

Any trailing buffered text that does not end with a newline is flushed when the test finishes.

The returned writer is safe for concurrent use from multiple parallel tests.