test(add): show config-include cannot be enabled in top-level config

This commit is contained in:
Leon Schuermann 2024-07-05 20:16:15 -04:00
parent 606adeeea6
commit 8bfc31f975

View File

@ -48,6 +48,37 @@ fn simple() {
assert_eq!(gctx.get::<i32>("key3").unwrap(), 4);
}
#[cargo_test]
fn enable_in_unstable_config() {
// config-include enabled in the unstable config table:
write_config_at(
".cargo/config.toml",
"
include = 'other.toml'
key1 = 1
key2 = 2
[unstable]
config-include = true
",
);
write_config_at(
".cargo/other.toml",
"
key2 = 3
key3 = 4
",
);
let gctx = GlobalContextBuilder::new()
.nightly_features_allowed(true)
.build();
// On this commit, enabling `config-include` in the top-level
// configuration does not yet work.
assert_eq!(gctx.get::<i32>("key1").unwrap(), 1);
assert_eq!(gctx.get::<i32>("key2").unwrap(), 2);
assert_eq!(gctx.get::<i32>("key3").ok(), None);
}
#[cargo_test]
fn works_with_cli() {
write_config_at(