Skip to content

Commit

Permalink
Remove mod files and mod inside files directly
Browse files Browse the repository at this point in the history
  • Loading branch information
JamyGolden committed May 16, 2024
1 parent 25fe069 commit bede6e9
Show file tree
Hide file tree
Showing 13 changed files with 82 additions and 81 deletions.
12 changes: 11 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
mod cli;
mod config;
mod constants;
mod operations;
mod operations {
pub mod apply;
pub mod build;
pub mod config;
pub mod current;
pub mod info;
pub mod init;
pub mod install;
pub mod list;
pub mod update;
}
mod utils;

use crate::cli::{build_cli, get_matches};
Expand Down
9 changes: 0 additions & 9 deletions src/operations/mod.rs

This file was deleted.

26 changes: 13 additions & 13 deletions tests/cli_apply_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{
use crate::utils::{
read_file_to_string, setup, write_to_file, CURRENT_SCHEME_FILE_NAME, REPO_NAME,
};
use anyhow::Result;
Expand All @@ -21,8 +21,8 @@ fn test_cli_apply_subcommand_with_setup() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, _) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -59,7 +59,7 @@ fn test_cli_apply_subcommand_without_setup() -> Result<()> {
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -88,8 +88,8 @@ fn test_cli_apply_subcommand_invalid_scheme_name() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (_, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -118,7 +118,7 @@ fn test_cli_apply_subcommand_invalid_scheme_system() -> Result<()> {
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -147,7 +147,7 @@ fn test_cli_apply_subcommand_no_scheme_system() -> Result<()> {
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -180,8 +180,8 @@ hooks = ["echo 'This '", "echo 'is '", "echo 'expected '", "echo 'output.'"]
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -221,8 +221,8 @@ hook = "echo \"path: %f\""
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
12 changes: 6 additions & 6 deletions tests/cli_config_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{setup, write_to_file};
use crate::utils::{setup, write_to_file};
use anyhow::Result;

#[test]
Expand All @@ -23,7 +23,7 @@ themes-dir = "scripts"
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -56,7 +56,7 @@ themes-dir = "colors"
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand All @@ -78,7 +78,7 @@ fn test_cli_config_with_config_flag() -> Result<()> {
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand All @@ -103,7 +103,7 @@ fn test_cli_config_with_data_flag() -> Result<()> {
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
8 changes: 4 additions & 4 deletions tests/cli_current_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{setup, write_to_file, CURRENT_SCHEME_FILE_NAME};
use crate::utils::{setup, write_to_file, CURRENT_SCHEME_FILE_NAME};
use anyhow::Result;

#[test]
Expand All @@ -17,7 +17,7 @@ fn test_cli_current_subcommand_with_setup() -> Result<()> {
// ---
// Act
// ---
let (stdout, stderr) = common::run_command(command_vec).unwrap();
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -46,7 +46,7 @@ fn test_cli_current_subcommand_without_setup() -> Result<()> {
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
24 changes: 12 additions & 12 deletions tests/cli_general_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{
use crate::utils::{
cleanup, read_file_to_string, setup, write_to_file, COMMAND_NAME, CURRENT_SCHEME_FILE_NAME,
REPO_NAME,
};
Expand All @@ -17,7 +17,7 @@ fn test_cli_no_arguments() -> Result<()> {
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -60,8 +60,8 @@ hook = "echo 'test_cli_config_path_tilde_as_home_config_output'"
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -116,18 +116,18 @@ fn test_cli_default_data_path() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
common::run_command(init_command_vec.clone()).unwrap();
utils::run_install_command(&config_path, &data_path)?;
utils::run_command(init_command_vec.clone()).unwrap();

// This test is important to determine the config.toml is being read correctly
assert_eq!(
read_file_to_string(&current_scheme_file_path)?,
init_scheme_name
);

common::run_command(apply_command_vec.clone()).unwrap();
common::run_command(init_command_vec).unwrap();
let (stdout, stderr) = common::run_command(apply_command_vec).unwrap();
utils::run_command(apply_command_vec.clone()).unwrap();
utils::run_command(init_command_vec).unwrap();
let (stdout, stderr) = utils::run_command(apply_command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -175,8 +175,8 @@ fn test_cli_data_path_tilde_as_home() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
6 changes: 3 additions & 3 deletions tests/cli_generatecompletion_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::setup;
use crate::utils::setup;
use anyhow::Result;

fn generate_shell_completion_test(shell_name: &str) -> Result<String> {
Expand All @@ -15,7 +15,7 @@ fn generate_shell_completion_test(shell_name: &str) -> Result<String> {
// ---
// Act
// ---
let (stdout, stderr) = common::run_command(command_vec).unwrap();
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// Ok((stdout, stderr, cleanup))

Expand Down
18 changes: 9 additions & 9 deletions tests/cli_info_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{setup, write_to_file, REPO_NAME};
use crate::utils::{setup, write_to_file, REPO_NAME};
use anyhow::Result;

#[test]
Expand All @@ -15,8 +15,8 @@ fn test_cli_info_subcommand_all_with_setup() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, _) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -48,8 +48,8 @@ fn test_cli_info_subcommand_with_setup() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, _) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -79,7 +79,7 @@ fn test_cli_info_subcommand_without_setup() -> Result<()> {
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -111,8 +111,8 @@ fn test_cli_info_subcommand_with_setup_invalid_scheme_name() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (_, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
12 changes: 6 additions & 6 deletions tests/cli_init_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{
use crate::utils::{
read_file_to_string, setup, write_to_file, CURRENT_SCHEME_FILE_NAME, REPO_NAME,
};
use anyhow::Result;
Expand All @@ -19,7 +19,7 @@ fn test_cli_init_subcommand_without_setup() -> Result<()> {
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand All @@ -43,7 +43,7 @@ fn test_cli_init_subcommand_with_setup() -> Result<()> {
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -73,8 +73,8 @@ fn test_cli_init_subcommand_with_config_default_scheme() -> Result<()> {
// ---
// Act
// ---
common::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = common::run_command(command_vec).unwrap();
utils::run_install_command(&config_path, &data_path)?;
let (stdout, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
14 changes: 7 additions & 7 deletions tests/cli_install_subcommand_tests.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mod common;
mod utils;

use crate::common::{setup, write_to_file};
use crate::utils::{setup, write_to_file};
use anyhow::Result;

#[test]
Expand Down Expand Up @@ -28,7 +28,7 @@ themes-dir = "some-dir"
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down Expand Up @@ -61,7 +61,7 @@ themes-dir = "some-dir""##;
// ---
// Act
// ---
let (_, stderr) = common::run_command(command_vec).unwrap();
let (_, stderr) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand All @@ -87,7 +87,7 @@ fn test_cli_install_subcommand_without_setup() -> Result<()> {
// ---
// Act
// ---
let (stdout, _) = common::run_command(command_vec).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand All @@ -112,8 +112,8 @@ fn test_cli_install_subcommand_with_setup() -> Result<()> {
// ---
// Act
// ---
common::run_command(command_vec.clone()).unwrap();
let (stdout, _) = common::run_command(command_vec).unwrap();
utils::run_command(command_vec.clone()).unwrap();
let (stdout, _) = utils::run_command(command_vec).unwrap();

// ------
// Assert
Expand Down
Loading

0 comments on commit bede6e9

Please sign in to comment.