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
// Copyright (c) 2025 R3BL LLC. Licensed under Apache License, Version 2.0.
//! System-level PTY tests - end-to-end validation of readline editing in real pseudo-terminals.
//!
//! These tests validate the complete readline editing stack in a real PTY environment:
//! - [`LineState`] async event handling and state management
//! - Line editing operations (insert, delete, navigation)
//! - Word boundary detection with Unicode support
//! - Terminal rendering and cursor positioning
//!
//! All tests use **real keyboard input sequences** to verify the system handles actual user input correctly.
//!
//! Run with: `cargo test test_pty_readline -- --nocapture`
//!
//! # Testing Philosophy
//!
//! **PTY tests validate end-to-end behavior** because:
//! - **Real-world testing**: Tests run in an actual pseudo-terminal, matching production environment
//! - **Integration validation**: Verifies the complete stack from keyboard input → line state → terminal output
//! - **Unicode safety**: Validates multi-byte character handling in actual terminal environment
//!
//! **Unit tests** (in [`line_state`]) validate individual handler logic with mocked I/O.
//! **PTY tests** validate the full system works correctly in a real terminal.
//!
//! See the [parent module] for the overall testing strategy.
//!
//! [`LineState`]: super::LineState
//! [`line_state`]: super::line_state
//! [parent module]: mod@super
// Skip rustfmt for rest of file.
// https://stackoverflow.com/a/75910283/2085356
// These PTY tests use DirectToAnsiInputDevice which is Linux-only.
// On macOS/Windows, Crossterm backend is used instead and these tests are skipped.
// These PTY tests use only portable_pty (no DirectToAnsiInputDevice) and work cross-platform.