1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//! Test utilities for RCH.
//!
//! Provides structured test logging, output capture, and debugging infrastructure
//! for consistent test output across the codebase.
//!
//! # Features
//!
//! - JSONL test logs for CI debugging
//! - Structured phase markers (TEST START/PASS/FAIL)
//! - Terminal metadata capture
//! - Zero-boilerplate logging with `TestGuard`
//!
//! # Quick Start (Unit Tests)
//!
//! For simple unit tests, use `TestGuard` which auto-logs pass/fail:
//!
//! ```ignore
//! use rch_common::testing::TestGuard;
//!
//! #[test]
//! fn test_simple() {
//! let _guard = TestGuard::new("test_simple");
//! // ... test logic ...
//! // TEST PASS logged automatically on success
//! // TEST FAIL logged automatically if test panics
//! }
//! ```
//!
//! Or use the macro for automatic name detection:
//!
//! ```ignore
//! use rch_common::test_guard;
//!
//! #[test]
//! fn test_auto_name() {
//! let _guard = test_guard!(); // Uses "test_auto_name" as the test name
//! assert_eq!(1 + 1, 2);
//! }
//! ```
//!
//! # Detailed Logging (E2E/Integration Tests)
//!
//! For tests that need detailed phase logging, use `TestLogger`:
//!
//! ```ignore
//! use rch_common::testing::{TestLogger, TestPhase};
//!
//! #[test]
//! fn test_detailed() {
//! let logger = TestLogger::for_test("test_detailed");
//! logger.log(TestPhase::Setup, "Initializing test state");
//! // ... test logic ...
//! logger.log(TestPhase::Verify, "Checking results");
//! logger.pass(); // or logger.fail("reason")
//! }
//! ```
//!
//! # Environment Variables
//!
//! - `RCH_TEST_LOGGING=1`: Force enable structured logging
//! - `RCH_TEST_LOGGING=0`: Force disable (fastest, no I/O)
//! - Default: Enabled in CI (`CI=true`), disabled locally
pub use ;