Skip to content

Commit 61fe875

Browse files
committed
test(config-include): show glob/template syntax isnt disallowed
Which we want to disallow to reserve for future.
1 parent f3b7ff7 commit 61fe875

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

tests/testsuite/config_include.rs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,3 +684,51 @@ Caused by:
684684
"#]],
685685
);
686686
}
687+
688+
#[cargo_test]
689+
fn disallow_glob_syntax() {
690+
// Reserved for future extension
691+
write_config_toml("include = 'config-*.toml'");
692+
let gctx = GlobalContextBuilder::new()
693+
.unstable_flag("config-include")
694+
.build_err();
695+
assert_error(
696+
gctx.unwrap_err(),
697+
str![[r#"
698+
could not load Cargo configuration
699+
700+
Caused by:
701+
failed to load config include `config-*.toml` from `[ROOT]/.cargo/config.toml`
702+
703+
Caused by:
704+
failed to read configuration file `[ROOT]/.cargo/config-*.toml`
705+
706+
Caused by:
707+
[NOT_FOUND]
708+
"#]],
709+
);
710+
}
711+
712+
#[cargo_test]
713+
fn disallow_template_syntax() {
714+
// Reserved for future extension
715+
write_config_toml("include = '{workspace-root}/config.toml'");
716+
let gctx = GlobalContextBuilder::new()
717+
.unstable_flag("config-include")
718+
.build_err();
719+
assert_error(
720+
gctx.unwrap_err(),
721+
str![[r#"
722+
could not load Cargo configuration
723+
724+
Caused by:
725+
failed to load config include `{workspace-root}/config.toml` from `[ROOT]/.cargo/config.toml`
726+
727+
Caused by:
728+
failed to read configuration file `[ROOT]/.cargo/{workspace-root}/config.toml`
729+
730+
Caused by:
731+
[NOT_FOUND]
732+
"#]],
733+
);
734+
}

0 commit comments

Comments
 (0)