You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
378 B

  1. use crate::builtins::Builtin;
  2. use crate::error::ShellError;
  3. pub struct Exit;
  4. impl Builtin for Exit {
  5. fn execute(&mut self, _: Vec<String>) -> Result<(), ShellError> {
  6. Err(ShellError::Exit)
  7. }
  8. }
  9. #[cfg(test)]
  10. mod tests {
  11. use super::*;
  12. #[test]
  13. fn test_exit() {
  14. assert_eq!(Exit.execute(vec!["arg".to_string()]), Err(ShellError::Exit))
  15. }
  16. }