diff options
Diffstat (limited to 'tests/cli.rs')
-rw-r--r-- | tests/cli.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/cli.rs b/tests/cli.rs index ccf837b..8197a92 100644 --- a/tests/cli.rs +++ b/tests/cli.rs @@ -1,27 +1,27 @@ +use anyhow::Result; use assert_cmd::cargo::cargo_bin; use rexpect::{session::PtySession, spawn}; -use std::error::Error; -fn spawn_interactive_process() -> Result<PtySession, Box<dyn Error>> { +fn spawn_interactive_process() -> Result<PtySession> { let path = cargo_bin(env!("CARGO_PKG_NAME")); let mut process = spawn(&path.display().to_string(), Some(3000))?; expect_prompt(&mut process)?; Ok(process) } -fn expect_prompt(p: &mut PtySession) -> Result<(), Box<dyn Error>> { +fn expect_prompt(p: &mut PtySession) -> Result<()> { p.exp_string("> ")?; Ok(()) } #[test] -fn shows_a_prompt() -> Result<(), Box<dyn Error>> { +fn shows_a_prompt() -> Result<()> { spawn_interactive_process()?; Ok(()) } #[test] -fn does_nothing_after_receiving_whitespace_input() -> Result<(), Box<dyn Error>> { +fn does_nothing_after_receiving_whitespace_input() -> Result<()> { let mut p = spawn_interactive_process()?; p.send_line("")?; expect_prompt(&mut p)?; @@ -31,7 +31,7 @@ fn does_nothing_after_receiving_whitespace_input() -> Result<(), Box<dyn Error>> } #[test] -fn quits_when_eof_is_sent() -> Result<(), Box<dyn Error>> { +fn quits_when_eof_is_sent() -> Result<()> { let mut p = spawn_interactive_process()?; p.send_control('d')?; p.exp_eof()?; @@ -39,7 +39,7 @@ fn quits_when_eof_is_sent() -> Result<(), Box<dyn Error>> { } #[test] -fn quits_when_exit_command_is_sent() -> Result<(), Box<dyn Error>> { +fn quits_when_exit_command_is_sent() -> Result<()> { let mut p = spawn_interactive_process()?; p.send_line("exit")?; p.exp_eof()?; |