test: Fixed Windows CLI tests (forgot to add unix cfg check)

This commit is contained in:
2025-09-15 10:24:17 -06:00
parent e8de47dc52
commit 261ec0bb6d
5 changed files with 73 additions and 72 deletions
+2 -2
View File
@@ -11,11 +11,11 @@ use std::io::{self, IsTerminal, Read, Write};
use std::panic::PanicHookInfo;
use crate::cli::wrap_and_run_command;
use crate::utils::persist_config_file;
use dialoguer::Editor;
use std::panic;
use std::process::exit;
use validator::Validate;
use crate::utils::persist_config_file;
mod cli;
mod command;
@@ -242,7 +242,7 @@ async fn main() -> Result<()> {
new_config
.validate()
.with_context(|| "updated configuration is invalid")?;
persist_config_file(&new_config)?;
persist_config_file(&new_config)?;
println!("✓ Configuration updated successfully");
}
Commands::Sync {} => {
+14 -14
View File
@@ -20,10 +20,10 @@
//! rc.validate().unwrap();
//! ```
use collections::HashSet;
use crate::providers::local::LocalProvider;
use crate::providers::{SecretProvider, SupportedProvider};
use anyhow::{Context, Result};
use collections::HashSet;
use log::debug;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
@@ -215,19 +215,19 @@ fn default_provider_exists(config: &Config) -> Result<(), ValidationError> {
}
fn providers_names_are_unique(config: &Config) -> Result<(), ValidationError> {
let mut names = HashSet::new();
for provider in &config.providers {
if let Some(name) = &provider.name {
if !names.insert(name) {
let mut err = ValidationError::new("duplicate_provider_name");
err.message = Some(Cow::Borrowed(
"Provider names must be unique; duplicate found",
));
return Err(err);
}
}
}
Ok(())
let mut names = HashSet::new();
for provider in &config.providers {
if let Some(name) = &provider.name
&& !names.insert(name)
{
let mut err = ValidationError::new("duplicate_provider_name");
err.message = Some(Cow::Borrowed(
"Provider names must be unique; duplicate found",
));
return Err(err);
}
}
Ok(())
}
impl Default for Config {
+6 -6
View File
@@ -140,15 +140,15 @@ pub(in crate::providers) fn resolve_git(override_path: Option<&PathBuf>) -> Resu
}
pub(in crate::providers) fn default_git_username(git: &Path) -> Result<String> {
debug!("Checking for default git username");
run_git_config_capture(git, &["config", "user.name"])
.with_context(|| "unable to determine git user name")
debug!("Checking for default git username");
run_git_config_capture(git, &["config", "user.name"])
.with_context(|| "unable to determine git user name")
}
pub(in crate::providers) fn default_git_email(git: &Path) -> Result<String> {
debug!("Checking for default git username");
run_git_config_capture(git, &["config", "user.email"])
.with_context(|| "unable to determine git user email")
debug!("Checking for default git username");
run_git_config_capture(git, &["config", "user.email"])
.with_context(|| "unable to determine git user email")
}
pub(in crate::providers) fn ensure_git_available(git: &Path) -> Result<()> {