diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 6fe1172cd..b97f1d04e 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -9,6 +9,7 @@ use std::path::{Path, PathBuf}; use cargo::core::features::{GitFeatures, GitoxideFeatures}; use cargo::core::{PackageIdSpec, Shell}; +use cargo::util::auth::RegistryConfig; use cargo::util::context::{ self, Definition, GlobalContext, JobsConfig, SslVersionConfig, StringList, }; @@ -2164,6 +2165,37 @@ gitoxide = \"fetch\" } } +#[cargo_test] +fn nonmergable_lists() { + let root_path = paths::root().join(".cargo/config.toml"); + write_config_at( + &root_path, + "\ +[registries.example] +credential-provider = ['a', 'b'] +", + ); + + let foo_path = paths::root().join("foo/.cargo/config.toml"); + write_config_at( + &foo_path, + "\ +[registries.example] +credential-provider = ['c', 'd'] +", + ); + + let gctx = GlobalContextBuilder::new().cwd("foo").build(); + let provider = gctx + .get::>(&format!("registries.example")) + .unwrap() + .unwrap() + .credential_provider + .unwrap(); + assert_eq!(provider.path.raw_value(), "a"); + assert_eq!(provider.args, ["b", "c", "d"]); +} + #[cargo_test] fn build_std() { let gctx = GlobalContextBuilder::new()