Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support automated UX testing #847

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
169 changes: 166 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ unicode-segmentation = "1.9.0"
unicode-width = "0.1.9"

[dev-dependencies]
alacritty-test = { git = "https://github.com/YizhePKU/alacritty-test.git", rev = "6c4df50" }
gethostname = "0.4.0"
pretty_assertions = "1.4.0"
rstest = { version = "0.18.0", default-features = false }
Expand Down
25 changes: 25 additions & 0 deletions src/bin/testbin.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//! Test binary for UX testing.

use reedline::{DefaultPrompt, DefaultPromptSegment, Reedline, Signal};
use std::io;

fn main() -> io::Result<()> {
let mut line_editor = Reedline::create();
let prompt = DefaultPrompt::new(
DefaultPromptSegment::Basic("Reedline".to_string()),
DefaultPromptSegment::Empty,
);

loop {
let sig = line_editor.read_line(&prompt)?;
match sig {
Signal::Success(buffer) => {
println!("We processed: {buffer}");
}
Signal::CtrlD | Signal::CtrlC => {
println!("\nAborted!");
break Ok(());
}
}
}
}
Loading
Loading