Show existing behavior

This commit is contained in:
Arlo Siemsen 2024-12-10 12:48:44 -06:00 committed by Arlo Siemsen
parent 045bf21b36
commit 1948c90a78

View File

@ -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::<Option<RegistryConfig>>(&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()