diff --git a/src/builtins/mod.rs b/src/builtins/mod.rs index f39bc04..8da4acd 100644 --- a/src/builtins/mod.rs +++ b/src/builtins/mod.rs @@ -2,6 +2,7 @@ use crate::error::ShellError; use crate::prompt::PromptStyle; use once_cell::unsync::Lazy; +mod blahaj; mod cd; mod change_prompt; mod exit; @@ -15,7 +16,7 @@ mod quote; mod segfault; mod sus; mod time; -mod blahaj; + pub struct BuiltinConfig { @@ -36,6 +37,7 @@ trait Builtin: Sync + Send { const BUILTINS: Lazy)>> = Lazy::new(|| { vec![ + ("blahaj", Box::new(blahaj::Blahaj)), ("cd", Box::new(cd::Cd)), ("change-prompt", Box::new(change_prompt::ChangePrompt)), ("exit", Box::new(exit::Exit)), @@ -49,7 +51,6 @@ const BUILTINS: Lazy)>> = Lazy::new(|| { ("segfault", Box::new(segfault::Segfault)), ("sus", Box::new(sus::Sus)), ("time", Box::new(time::Time)), - ("blahaj", Box::new(blahaj::Blahaj)), ] }); @@ -76,6 +77,12 @@ pub fn execute_builtin( mod tests { use super::*; + #[test] + fn test_is_builtin_blahaj(){ + assert!(is_builtin("blahaj")); + } + } + #[test] fn test_is_builtin_cd() { assert!(is_builtin("cd")); @@ -121,6 +128,11 @@ mod tests { assert!(is_builtin("pwd")); } + #[test] + fn test_is_builtin_quote() { + assert!(is_builtin("quote")); +} + #[test] fn test_is_builtin_segfault() { assert!(is_builtin("segfault")); @@ -131,11 +143,6 @@ mod tests { assert!(is_builtin("sus")); } - #[test] - fn test_is_builtin_quote() { - assert!(is_builtin("quote")); - } - #[test] fn test_is_builtin_time() { assert!(is_builtin("time")); @@ -146,8 +153,3 @@ mod tests { assert!(!is_builtin("notabuiltin")) } - #[test] - fn test_is_builtin_blahaj(){ - assert!(is_builtin("blahaj")); - } -}