From 91c109a90245edb3791cd3234787a8a1f6a8f794 Mon Sep 17 00:00:00 2001 From: a-kenji Date: Wed, 17 Mar 2021 22:50:03 +0100 Subject: [PATCH] Move test to /unit --- src/cli.rs | 2 +- src/common/input/config.rs | 20 +++++++++++++++++-- src/common/input/keybinds.rs | 2 +- .../input/{ut => unit}/keybinds_test.rs | 0 src/common/input/ut/config_test.rs | 19 ------------------ 5 files changed, 20 insertions(+), 23 deletions(-) rename src/common/input/{ut => unit}/keybinds_test.rs (100%) delete mode 100644 src/common/input/ut/config_test.rs diff --git a/src/cli.rs b/src/cli.rs index 740879f0..d4c0f78a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,7 +1,7 @@ use std::path::PathBuf; use structopt::StructOpt; -#[derive(StructOpt, Debug)] +#[derive(StructOpt, Default, Debug)] #[structopt(name = "zellij")] pub struct CliArgs { /// Send "split (direction h == horizontal / v == vertical)" to active zellij session diff --git a/src/common/input/config.rs b/src/common/input/config.rs index 668b4106..7d804d68 100644 --- a/src/common/input/config.rs +++ b/src/common/input/config.rs @@ -122,5 +122,21 @@ impl From for ConfigError { // The unit test location. #[cfg(test)] -#[path = "./ut/config_test.rs"] -mod config_test; +mod config_test { + use super::*; + + #[test] + fn no_config_file_equals_default_config() { + let no_file = PathBuf::from(r"../fixtures/config/config.yamlll"); + let config = Config::from_option_or_default(Some(no_file)).unwrap(); + let default = Config::default(); + assert_eq!(config, default); + } + + #[test] + fn no_config_option_file_equals_default_config() { + let config = Config::from_option_or_default(None).unwrap(); + let default = Config::default(); + assert_eq!(config, default); + } +} diff --git a/src/common/input/keybinds.rs b/src/common/input/keybinds.rs index 0c37693c..c70123b6 100644 --- a/src/common/input/keybinds.rs +++ b/src/common/input/keybinds.rs @@ -368,5 +368,5 @@ impl From for ModeKeybinds { // The unit test location. #[cfg(test)] -#[path = "./ut/keybinds_test.rs"] +#[path = "./unit/keybinds_test.rs"] mod keybinds_test; diff --git a/src/common/input/ut/keybinds_test.rs b/src/common/input/unit/keybinds_test.rs similarity index 100% rename from src/common/input/ut/keybinds_test.rs rename to src/common/input/unit/keybinds_test.rs diff --git a/src/common/input/ut/config_test.rs b/src/common/input/ut/config_test.rs deleted file mode 100644 index eb4bc960..00000000 --- a/src/common/input/ut/config_test.rs +++ /dev/null @@ -1,19 +0,0 @@ -//! For Configuration Options - -use super::super::config::*; -use std::path::PathBuf; - -#[test] -fn no_config_file_equals_default_config() { - let no_file = PathBuf::from(r"../fixtures/config/config.yamlll"); - let config = Config::from_option_or_default(Some(no_file)).unwrap(); - let default = Config::default(); - assert_eq!(config, default); -} - -#[test] -fn no_config_option_file_equals_default_config() { - let config = Config::from_option_or_default(None).unwrap(); - let default = Config::default(); - assert_eq!(config, default); -}