#[test]
fn test_cov_comply_rules_json() {
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Rules {
format: crate::cli::args::ComplyFormat::Json,
});
assert!(result.is_ok());
}
#[test]
fn test_cov_comply_rules_markdown() {
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Rules {
format: crate::cli::args::ComplyFormat::Markdown,
});
assert!(result.is_ok());
}
#[test]
fn test_cov_comply_init_already_exists_in_cwd() {
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Init {
scope: crate::cli::args::ComplyScopeArg::Project,
pzsh: false,
strict: false,
});
let _ = result;
}
#[test]
fn test_cov_comply_init_pzsh_strict() {
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Init {
scope: crate::cli::args::ComplyScopeArg::All,
pzsh: true,
strict: true,
});
let _ = result;
}
#[test]
fn test_cov_comply_init_user_scope() {
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Init {
scope: crate::cli::args::ComplyScopeArg::User,
pzsh: false,
strict: false,
});
let _ = result;
}
#[test]
fn test_cov_comply_init_system_scope() {
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Init {
scope: crate::cli::args::ComplyScopeArg::System,
pzsh: false,
strict: true,
});
let _ = result;
}
#[test]
fn test_cov_comply_track_discover() {
let dir = TempDir::new().unwrap();
fs::write(dir.path().join("test.sh"), "#!/bin/sh\necho ok\n").unwrap();
fs::write(
dir.path().join("Makefile"),
".PHONY: all\nall:\n\t@echo done\n",
)
.unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Track {
command: crate::cli::args::ComplyTrackCommands::Discover {
path: dir.path().to_path_buf(),
scope: crate::cli::args::ComplyScopeArg::Project,
},
});
assert!(result.is_ok());
}
#[test]
fn test_cov_comply_track_discover_all() {
let dir = TempDir::new().unwrap();
fs::write(dir.path().join("test.sh"), "#!/bin/sh\necho ok\n").unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Track {
command: crate::cli::args::ComplyTrackCommands::Discover {
path: dir.path().to_path_buf(),
scope: crate::cli::args::ComplyScopeArg::All,
},
});
assert!(result.is_ok());
}
#[test]
fn test_cov_comply_track_list() {
let dir = TempDir::new().unwrap();
fs::write(dir.path().join("test.sh"), "#!/bin/sh\necho ok\n").unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Track {
command: crate::cli::args::ComplyTrackCommands::List {
path: dir.path().to_path_buf(),
scope: None,
},
});
assert!(result.is_ok());
}
#[test]
fn test_cov_comply_track_list_project() {
let dir = TempDir::new().unwrap();
fs::write(dir.path().join("test.sh"), "#!/bin/sh\necho ok\n").unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Track {
command: crate::cli::args::ComplyTrackCommands::List {
path: dir.path().to_path_buf(),
scope: Some(crate::cli::args::ComplyScopeArg::Project),
},
});
assert!(result.is_ok());
}
#[test]
fn test_cov_comply_check_scope_user() {
let dir = TempDir::new().unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Check {
path: dir.path().to_path_buf(),
scope: Some(crate::cli::args::ComplyScopeArg::User),
strict: false,
failures_only: false,
min_score: None,
format: crate::cli::args::ComplyFormat::Text,
});
let _ = result;
}
#[test]
fn test_cov_comply_check_scope_system() {
let dir = TempDir::new().unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Check {
path: dir.path().to_path_buf(),
scope: Some(crate::cli::args::ComplyScopeArg::System),
strict: false,
failures_only: false,
min_score: None,
format: crate::cli::args::ComplyFormat::Text,
});
let _ = result;
}
#[test]
fn test_cov_comply_check_scope_all() {
let dir = TempDir::new().unwrap();
let result =
super::comply_cmds::handle_comply_command(crate::cli::args::ComplyCommands::Check {
path: dir.path().to_path_buf(),
scope: Some(crate::cli::args::ComplyScopeArg::All),
strict: false,
failures_only: false,
min_score: None,
format: crate::cli::args::ComplyFormat::Text,
});
let _ = result;
}
#[test]
fn test_cov_config_analyze_human() {
let dir = TempDir::new().unwrap();
let file = dir.path().join(".bashrc");
fs::write(
&file,
"#!/bin/bash\nexport PATH=\"/usr/local/bin:$PATH\"\nexport PATH=\"/usr/local/bin:$PATH\"\nalias ll='ls -la'\n",
)
.unwrap();
let result = config_analyze_command(&file, ConfigOutputFormat::Human);
assert!(result.is_ok());
}
#[test]
fn test_cov_config_analyze_json() {
let dir = TempDir::new().unwrap();
let file = dir.path().join(".bashrc");
fs::write(
&file,
"#!/bin/bash\nexport PATH=\"/usr/local/bin:$PATH\"\nalias ll='ls -la'\n",
)
.unwrap();
let result = config_analyze_command(&file, ConfigOutputFormat::Json);
assert!(result.is_ok());
}
#[test]
fn test_cov_config_lint_clean() {
let dir = TempDir::new().unwrap();
let file = dir.path().join(".profile");
fs::write(&file, "# Clean profile\n").unwrap();
let result = config_lint_command(&file, ConfigOutputFormat::Human);
assert!(result.is_ok());
}
#[test]
fn test_cov_config_lint_json() {
let dir = TempDir::new().unwrap();
let file = dir.path().join(".zshrc");
fs::write(&file, "# Clean zshrc\n").unwrap();
let result = config_lint_command(&file, ConfigOutputFormat::Json);
assert!(result.is_ok());
}
#[test]
fn test_cov_config_purify_dry_run() {
let dir = TempDir::new().unwrap();
let file = dir.path().join(".bashrc");
fs::write(
&file,
"#!/bin/bash\nexport PATH=\"/usr/local/bin:$PATH\"\nexport PATH=\"/usr/local/bin:$PATH\"\n",
)
.unwrap();
let result =
super::config_cmds::handle_config_command(crate::cli::args::ConfigCommands::Purify {
input: file,
output: None,
fix: false,
no_backup: false,
dry_run: true,
});
assert!(result.is_ok());
}
#[test]
fn test_cov_config_purify_output_file() {
let dir = TempDir::new().unwrap();
let input = dir.path().join(".bashrc");
let output = dir.path().join(".bashrc.purified");
fs::write(
&input,
"#!/bin/bash\nexport PATH=\"/usr/local/bin:$PATH\"\nexport PATH=\"/usr/local/bin:$PATH\"\n",
)
.unwrap();
let result =
super::config_cmds::handle_config_command(crate::cli::args::ConfigCommands::Purify {
input,
output: Some(output.clone()),
fix: false,
no_backup: false,
dry_run: false,
});
assert!(result.is_ok());
assert!(output.exists());
}
#[test]
fn test_cov_config_purify_stdout() {
let dir = TempDir::new().unwrap();
let input = dir.path().join(".bashrc");
fs::write(&input, "#!/bin/bash\nexport EDITOR=vim\n").unwrap();
let stdout_path = PathBuf::from("-");
let result =
super::config_cmds::handle_config_command(crate::cli::args::ConfigCommands::Purify {
input,
output: Some(stdout_path),
fix: false,
no_backup: false,
dry_run: false,
});
assert!(result.is_ok());
}
#[test]
fn test_cov_config_purify_fix_inplace() {
let dir = TempDir::new().unwrap();
let input = dir.path().join(".bashrc");
fs::write(
&input,
"#!/bin/bash\nexport PATH=\"/usr/local/bin:$PATH\"\nexport PATH=\"/usr/local/bin:$PATH\"\n",
)
.unwrap();
let result =
super::config_cmds::handle_config_command(crate::cli::args::ConfigCommands::Purify {
input,
output: None,
fix: true,
no_backup: false,
dry_run: false,
});
assert!(result.is_ok());
}
#[test]
fn test_cov_config_purify_fix_no_backup() {
let dir = TempDir::new().unwrap();
let input = dir.path().join(".bashrc");
fs::write(
&input,
"#!/bin/bash\nexport PATH=\"/usr/local/bin:$PATH\"\nexport PATH=\"/usr/local/bin:$PATH\"\n",
)
.unwrap();
let result =
super::config_cmds::handle_config_command(crate::cli::args::ConfigCommands::Purify {
input,
output: None,
fix: true,
no_backup: true,
dry_run: false,
});
assert!(result.is_ok());
}
include!("command_tests_lint_cov_tests_cov_2.rs");