Skip to content

Commit 1948c90

Browse files
committed
Show existing behavior
1 parent 045bf21 commit 1948c90

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/testsuite/config.rs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::path::{Path, PathBuf};
99

1010
use cargo::core::features::{GitFeatures, GitoxideFeatures};
1111
use cargo::core::{PackageIdSpec, Shell};
12+
use cargo::util::auth::RegistryConfig;
1213
use cargo::util::context::{
1314
self, Definition, GlobalContext, JobsConfig, SslVersionConfig, StringList,
1415
};
@@ -2164,6 +2165,37 @@ gitoxide = \"fetch\"
21642165
}
21652166
}
21662167

2168+
#[cargo_test]
2169+
fn nonmergable_lists() {
2170+
let root_path = paths::root().join(".cargo/config.toml");
2171+
write_config_at(
2172+
&root_path,
2173+
"\
2174+
[registries.example]
2175+
credential-provider = ['a', 'b']
2176+
",
2177+
);
2178+
2179+
let foo_path = paths::root().join("foo/.cargo/config.toml");
2180+
write_config_at(
2181+
&foo_path,
2182+
"\
2183+
[registries.example]
2184+
credential-provider = ['c', 'd']
2185+
",
2186+
);
2187+
2188+
let gctx = GlobalContextBuilder::new().cwd("foo").build();
2189+
let provider = gctx
2190+
.get::<Option<RegistryConfig>>(&format!("registries.example"))
2191+
.unwrap()
2192+
.unwrap()
2193+
.credential_provider
2194+
.unwrap();
2195+
assert_eq!(provider.path.raw_value(), "a");
2196+
assert_eq!(provider.args, ["b", "c", "d"]);
2197+
}
2198+
21672199
#[cargo_test]
21682200
fn build_std() {
21692201
let gctx = GlobalContextBuilder::new()

0 commit comments

Comments
 (0)