Skip to main content

torrust_tracker_deployer_lib/presentation/cli/views/testing/
mod.rs

1//! Testing utilities for `UserOutput` testing
2//!
3//! This module provides simplified testing infrastructure for capturing and asserting on output
4//! in tests across the codebase. It is organized into focused submodules:
5//!
6//! - [`test_writer`] - Writer implementation for capturing output to shared buffers
7//! - [`test_user_output`] - Test wrapper for `UserOutput` with buffer management
8//!
9//! # Quick Start
10//!
11//! For most tests, use `TestUserOutput::new()` to create a test output instance:
12//!
13//! ```rust,ignore
14//! use torrust_tracker_deployer_lib::presentation::cli::views::testing::TestUserOutput;
15//! use torrust_tracker_deployer_lib::presentation::cli::views::VerbosityLevel;
16//!
17//! let mut test_output = TestUserOutput::new(VerbosityLevel::Normal);
18//! test_output.output.progress("Processing...");
19//!
20//! assert_eq!(test_output.stderr(), "⏳ Processing...\n");
21//! assert_eq!(test_output.stdout(), "");
22//! ```
23
24pub mod test_user_output;
25pub mod test_writer;
26
27// Re-export main types for convenience
28pub use test_user_output::TestUserOutput;
29pub use test_writer::TestWriter;