Skip to main content

Module env

Module env 

Source
Expand description

Environment abstractions for testability.

This module provides traits that abstract over OS interactions, allowing tests to run without depending on actual terminal state, stdin piping, or clipboard contents.

§Default readers and test overrides

StdinSource::new and ClipboardSource::new both use “default” readers (DefaultStdin, DefaultClipboard) that consult a process-global override before falling back to the real OS-backed implementation.

Tests can swap in a mock without touching handler code by calling set_default_stdin_reader / set_default_clipboard_reader. The TestHarness in the standout-test crate wires these automatically.

Structs§

DefaultClipboard
Clipboard reader used by ClipboardSource::new.
DefaultStdin
Stdin reader used by StdinSource::new.
MockClipboard
Mock clipboard reader for testing.
MockEnv
Mock environment variable reader for testing.
MockStdin
Mock stdin reader for testing.
RealClipboard
Real clipboard reader using platform commands.
RealEnv
Real environment variable reader.
RealStdin
Real stdin reader using std::io.

Traits§

ClipboardReader
Abstraction over clipboard access.
EnvReader
Abstraction over environment variables.
StdinReader
Abstraction over stdin reading.

Functions§

reset_default_clipboard_reader
Clears the clipboard override installed by set_default_clipboard_reader.
reset_default_stdin_reader
Clears the stdin override installed by set_default_stdin_reader.
set_default_clipboard_reader
Installs a process-global clipboard reader that DefaultClipboard (and therefore ClipboardSource::new) will delegate to until reset_default_clipboard_reader is called.
set_default_stdin_reader
Installs a process-global stdin reader that DefaultStdin (and therefore StdinSource::new) will delegate to until reset_default_stdin_reader is called.