testutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package testutil provides testing utilities that work across platforms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CaptureOutput

func CaptureOutput(fn func()) (stdout, stderr string, err error)

CaptureOutput captures both stdout and stderr during the execution of fn. Returns stdout and stderr output separately. Returns an error if pipe creation or closing fails.

func CaptureStderr

func CaptureStderr(fn func()) (string, error)

CaptureStderr captures stderr during the execution of fn and returns the output. This implementation reads from the pipe concurrently to avoid deadlocks on Windows. Returns an error if pipe creation or closing fails.

func CaptureStdout

func CaptureStdout(fn func()) (string, error)

CaptureStdout captures stdout during the execution of fn and returns the output. This implementation reads from the pipe concurrently to avoid deadlocks on Windows where pipe buffers are smaller (typically 4KB-64KB) and can block if not drained. Returns an error if pipe creation or closing fails.

Types

This section is empty.

Jump to

Keyboard shortcuts

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