Problem
The REPL's terminal interaction (reedline integration, raw mode handling, output formatting) is currently untested. This led to a stairstepping bug in PR #102 that wasn't caught until manual testing.
Proposed Solution
Add integration tests using a PTY (pseudo-terminal) library to test actual terminal behavior:
#[test]
fn test_repl_output_no_stairstepping() {
let mut pty = PtySession::spawn("clemini").unwrap();
pty.send_line("What is 2+2?").unwrap();
let output = pty.read_until_prompt().unwrap();
// Each line should start at column 0 (no stairstepping)
for line in output.lines().skip(1) { // Skip prompt line
assert!(
!line.starts_with(' ') || is_intentional_indent(line),
"Stairstepping detected: {:?}",
line
);
}
}
Libraries to Consider
- expectrl - Rust expect-like library, good for REPL testing
- portable-pty - Cross-platform PTY support
- rexpect - Another expect-style library
Test Cases
- No stairstepping - Output lines start at column 0
- Ctrl-C handling - Returns to prompt cleanly
- History persistence - Commands saved and searchable
- Multiline input - Shift+Enter creates newlines (may need special key sequence)
Context
Problem
The REPL's terminal interaction (reedline integration, raw mode handling, output formatting) is currently untested. This led to a stairstepping bug in PR #102 that wasn't caught until manual testing.
Proposed Solution
Add integration tests using a PTY (pseudo-terminal) library to test actual terminal behavior:
Libraries to Consider
Test Cases
Context