Skip to content

Commit 8a0e380

Browse files
committed
add check for toml file
1 parent 6adbb3a commit 8a0e380

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/bootstrap/src/core/config/tests.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -307,10 +307,11 @@ fn clippy_rule_separate_prefix() {
307307

308308
#[test]
309309
fn verbose_tests_default_value() {
310-
let config = Config::parse(Flags::parse(&["build".into(), "compiler".into()]));
310+
let config = TestCtx::new().config("build").args(&["compiler".into()]).create_config();
311311
assert_eq!(config.verbose_tests, false);
312312

313-
let config = Config::parse(Flags::parse(&["build".into(), "compiler".into(), "-v".into()]));
313+
let config =
314+
TestCtx::new().config("build").args(&["compiler".into(), "-v".into()]).create_config();
314315
assert_eq!(config.verbose_tests, true);
315316
}
316317

@@ -643,18 +644,10 @@ fn test_include_precedence_over_profile() {
643644
"#;
644645
File::create(extension).unwrap().write_all(extension_content).unwrap();
645646

646-
let root_config = testdir.join("config.toml");
647-
let root_config_content = br#"
648-
profile = "dist"
649-
include = ["./extension.toml"]
650-
"#;
651-
File::create(&root_config).unwrap().write_all(root_config_content).unwrap();
652-
653647
let config = test_ctx
654648
.config("check")
655649
.with_default_toml_config(
656650
r#"
657-
profile = "dist"
658651
include = ["./extension.toml"]
659652
"#,
660653
)

src/bootstrap/src/core/config/toml/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,12 @@ impl Config {
152152
}
153153

154154
pub(crate) fn get_toml(file: &Path) -> Result<TomlConfig, toml::de::Error> {
155+
#[cfg(test)]
156+
{
157+
let tmp = std::env::temp_dir();
158+
assert!(file.starts_with(&tmp), "Expected path in temp dir {:?}, got {:?}", tmp, file);
159+
}
160+
155161
Self::get_toml_inner(file)
156162
}
157163

0 commit comments

Comments
 (0)