termiotest

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package termiotest provides *termio.Streams test helpers with buffer- backed streams and convenience accessors for the underlying buffers.

Quick start

s, in, out, errOut := termiotest.New()
fmt.Fprintln(s.Out, "hello")
fmt.Println(out.String()) // prints "hello\n"

Both New and NewTTY return the three *bytes.Buffer values corresponding to In, Out, and ErrOut so assertions are one line:

assert.Equal(t, "hello\n", out.String())

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() (s *termio.Streams, in, out, errOut *bytes.Buffer)

New returns a *termio.Streams backed by three *bytes.Buffer values. All three streams report as non-TTY. The returned buffers are the live underlying storage; writes to s.Out appear in out, etc.

func NewTTY

func NewTTY() (s *termio.Streams, in, out, errOut *bytes.Buffer)

NewTTY is like New but overrides all three TTY flags to true, making termio.Streams.IsInteractive return true. Use when the code path under test branches on TTY detection.

Types

This section is empty.

Jump to

Keyboard shortcuts

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