Skip to content

Commit

Permalink
make profile_user_dist test backward compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
Shourya742 committed Mar 9, 2025
1 parent c245b43 commit 1be6f63
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/bootstrap/src/core/config/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,15 @@ fn override_toml_duplicate() {
#[test]
fn profile_user_dist() {
fn get_toml(file: &Path) -> Result<TomlConfig, toml::de::Error> {
let contents =
if file.ends_with("bootstrap.toml") || env::var_os("RUST_BOOTSTRAP_CONFIG").is_some() {
"profile = \"user\"".to_owned()
} else {
assert!(file.ends_with("config.dist.toml"));
std::fs::read_to_string(file).unwrap()
};
let contents = if file.ends_with("bootstrap.toml")
|| file.ends_with("config.toml")
|| env::var_os("RUST_BOOTSTRAP_CONFIG").is_some()
{
"profile = \"user\"".to_owned()
} else {
assert!(file.ends_with("config.dist.toml") || file.ends_with("bootstrap.dist.toml"));
std::fs::read_to_string(file).unwrap()
};

toml::from_str(&contents).and_then(|table: toml::Value| TomlConfig::deserialize(table))
}
Expand Down

0 comments on commit 1be6f63

Please sign in to comment.