From 64296ca9c83011e3de4d9f1be02335d8eb1bfe95 Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Sat, 18 Jan 2025 13:27:03 +0100 Subject: Add tests for --- src/command/help.rs | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) (limited to 'src/command/help.rs') diff --git a/src/command/help.rs b/src/command/help.rs index b682fc0..da5831c 100644 --- a/src/command/help.rs +++ b/src/command/help.rs @@ -38,3 +38,50 @@ impl super::Command for Help { "\t\t\t\tPrints this help" } } + +#[cfg(test)] +mod tests { + + use super::*; + use crate::command::Command; + use crate::configuration::Configuration; + + #[test] + fn test_add_command() { + let help = Help::new(); + + let configuration = Configuration::new(); + help.execute(None, &configuration, "") + .expect("Could not call help"); + } + + #[test] + fn help_before_dependencies() { + let help = Help::new(); + let dependencies = help.before_dependencies(); + + assert_eq!(dependencies.len(), 0); + } + + #[test] + fn help_after_dependencies() { + let help = Help::new(); + let dependencies = help.after_dependencies(); + + assert_eq!(dependencies.len(), 0); + } + + // These two tests feel pointless but I'm doing it for the coverage :p + + #[test] + fn help_command_output() { + let help = Help::new(); + help.command(); + } + + #[test] + fn help_help_output() { + let help = Help::new(); + help.help(); + } +} -- cgit