From e324d72f78f2af8f0c3816890d576815ebe816d2 Mon Sep 17 00:00:00 2001 From: fdai7451 Date: Sat, 21 Jan 2023 17:32:49 +0100 Subject: [PATCH] test: add change prompt args test --- src/builtins/change_prompt.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/builtins/change_prompt.rs b/src/builtins/change_prompt.rs index 89c204f..3b181e5 100644 --- a/src/builtins/change_prompt.rs +++ b/src/builtins/change_prompt.rs @@ -34,3 +34,18 @@ impl Builtin for ChangePrompt { } } } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_change_prompt_no_args() { + assert_ne!(ChangePrompt.execute(&mut BuiltinConfig::new(), vec![]), Ok(())) + } + + #[test] + fn test_change_prompt_multiple_args() { + assert_eq!(ChangePrompt.execute(&mut BuiltinConfig::new(), vec!["1".to_string(), "2".to_string()]), Err(ShellError::ExecuteFailure("expected only one argument".to_string()))) + } +}