Skip to content

Commit 0c68c82

Browse files
committed
rename config_toml to with_default_toml_config
1 parent a29474d commit 0c68c82

File tree

3 files changed

+33
-18
lines changed

3 files changed

+33
-18
lines changed

src/bootstrap/src/core/builder/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ fn test_test_coverage() {
357357
#[test]
358358
fn test_prebuilt_llvm_config_path_resolution() {
359359
fn configure(config: &str) -> Config {
360-
TestCtx::new().config("build").config_toml(config).create_config()
360+
TestCtx::new().config("build").with_default_toml_config(config).create_config()
361361
}
362362

363363
// Removes Windows disk prefix if present

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

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::utils::tests::TestCtx;
2222
use crate::utils::tests::git::git_test;
2323

2424
pub(crate) fn parse(config: &str) -> Config {
25-
TestCtx::new().config("check").config_toml(config).create_config()
25+
TestCtx::new().config("check").with_default_toml_config(config).create_config()
2626
}
2727

2828
fn get_toml(file: &Path) -> Result<TomlConfig, toml::de::Error> {
@@ -58,7 +58,7 @@ fn download_ci_llvm() {
5858
// this doesn't make sense, as we are overriding it later.
5959
let if_unchanged_config = TestCtx::new()
6060
.config("check")
61-
.config_toml("llvm.download-ci-llvm = \"if-unchanged\"")
61+
.with_default_toml_config("llvm.download-ci-llvm = \"if-unchanged\"")
6262
.create_config();
6363
if if_unchanged_config.llvm_from_ci && if_unchanged_config.is_running_on_ci {
6464
let has_changes = if_unchanged_config.has_changes_from_upstream(LLVM_INVALIDATION_PATHS);
@@ -119,8 +119,11 @@ fn override_toml() {
119119
"--set=target.aarch64-apple-darwin.optimized-compiler-builtins=false",
120120
];
121121

122-
let config =
123-
TestCtx::new().config("check").config_toml(config_toml).args(&args).create_config();
122+
let config = TestCtx::new()
123+
.config("check")
124+
.with_default_toml_config(config_toml)
125+
.args(&args)
126+
.create_config();
124127

125128
assert_eq!(config.change_id, Some(ChangeId::Id(1)), "setting top-level value");
126129
assert_eq!(
@@ -182,7 +185,7 @@ fn override_toml() {
182185
fn override_toml_duplicate() {
183186
TestCtx::new()
184187
.config("check")
185-
.config_toml("change-id = 0")
188+
.with_default_toml_config("change-id = 0")
186189
.arg("--set")
187190
.arg("change-id=1")
188191
.arg("--set")
@@ -223,7 +226,10 @@ fn rust_optimize() {
223226
#[test]
224227
#[should_panic]
225228
fn invalid_rust_optimize() {
226-
TestCtx::new().config("check").config_toml("rust.optimize = \"a\"").create_config();
229+
TestCtx::new()
230+
.config("check")
231+
.with_default_toml_config("rust.optimize = \"a\"")
232+
.create_config();
227233
}
228234

229235
#[test]
@@ -332,7 +338,7 @@ fn verbose_tests_default_value() {
332338
fn parse_rust_std_features() {
333339
let config = TestCtx::new()
334340
.config("check")
335-
.config_toml("rust.std-features = [\"panic-unwind\", \"backtrace\"]")
341+
.with_default_toml_config("rust.std-features = [\"panic-unwind\", \"backtrace\"]")
336342
.create_config();
337343
let expected_features: BTreeSet<String> =
338344
["panic-unwind", "backtrace"].into_iter().map(|s| s.to_string()).collect();
@@ -341,22 +347,31 @@ fn parse_rust_std_features() {
341347

342348
#[test]
343349
fn parse_rust_std_features_empty() {
344-
let config =
345-
TestCtx::new().config("check").config_toml("rust.std-features = []").create_config();
350+
let config = TestCtx::new()
351+
.config("check")
352+
.with_default_toml_config("rust.std-features = []")
353+
.create_config();
346354
let expected_features: BTreeSet<String> = BTreeSet::new();
347355
assert_eq!(config.rust_std_features, expected_features);
348356
}
349357

350358
#[test]
351359
#[should_panic]
352360
fn parse_rust_std_features_invalid() {
353-
TestCtx::new().config("check").config_toml("rust.std-features = \"backtrace\"").create_config();
361+
TestCtx::new()
362+
.config("check")
363+
.with_default_toml_config("rust.std-features = \"backtrace\"")
364+
.create_config();
354365
}
355366

356367
#[test]
357368
fn parse_jobs() {
358369
assert_eq!(
359-
TestCtx::new().config("check").config_toml("build.jobs = 1").create_config().jobs,
370+
TestCtx::new()
371+
.config("check")
372+
.with_default_toml_config("build.jobs = 1")
373+
.create_config()
374+
.jobs,
360375
Some(1)
361376
);
362377
}
@@ -375,7 +390,7 @@ fn jobs_precedence() {
375390
let config = TestCtx::new()
376391
.config("check")
377392
.args(&["--set=build.jobs=12345"])
378-
.config_toml(
393+
.with_default_toml_config(
379394
r#"
380395
[build]
381396
jobs = 67890
@@ -389,7 +404,7 @@ fn jobs_precedence() {
389404
let config = TestCtx::new()
390405
.config("check")
391406
.args(&["--jobs=123", "--set=build.jobs=456"])
392-
.config_toml(
407+
.with_default_toml_config(
393408
r#"
394409
[build]
395410
jobs = 789
@@ -418,7 +433,7 @@ fn check_rustc_if_unchanged_paths() {
418433
fn test_explicit_stage() {
419434
let config = TestCtx::new()
420435
.config("check")
421-
.config_toml(
436+
.with_default_toml_config(
422437
r#"
423438
[build]
424439
test-stage = 1
@@ -439,7 +454,7 @@ fn test_explicit_stage() {
439454
let config = TestCtx::new()
440455
.config("check")
441456
.stage(2)
442-
.config_toml(
457+
.with_default_toml_config(
443458
r#"
444459
[build]
445460
test-stage = 1
@@ -463,7 +478,7 @@ fn test_exclude() {
463478
let exclude_path = "compiler";
464479
let config = TestCtx::new()
465480
.config("check")
466-
.config_toml(&format!("build.exclude=[\"{}\"]", exclude_path))
481+
.with_default_toml_config(&format!("build.exclude=[\"{}\"]", exclude_path))
467482
.create_config();
468483

469484
let first_excluded = config

src/bootstrap/src/utils/tests/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ impl ConfigBuilder {
9898
self
9999
}
100100

101-
pub fn config_toml(mut self, config_toml: &str) -> Self {
101+
pub fn with_default_toml_config(mut self, config_toml: &str) -> Self {
102102
let toml_path = self.directory.join("bootstrap.toml");
103103
std::fs::write(&toml_path, config_toml).unwrap();
104104
self.args.push("--config".to_string());

0 commit comments

Comments
 (0)