Skip to content

Commit 9d93415

Browse files
committed
Check 1.60 behavior
Signed-off-by: hi-rustin <[email protected]>
1 parent 626bf2c commit 9d93415

File tree

1 file changed

+46
-28
lines changed

1 file changed

+46
-28
lines changed

tests/testsuite/old_cargos.rs

Lines changed: 46 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ fn collect_all_toolchains() -> Vec<(Version, String)> {
8686
.map(|line| (rustc_version(line), line.to_string()))
8787
.collect();
8888

89-
// Also include *this* cargo.
90-
toolchains.push((rustc_version("this"), "this".to_string()));
9189
toolchains.sort_by(|a, b| a.0.cmp(&b.0));
9290
toolchains
9391
}
@@ -421,15 +419,27 @@ fn new_features() {
421419
p.build_dir().rm_rf();
422420
match run_cargo() {
423421
Ok(behavior) => {
424-
if version < &Version::new(1, 51, 0) && toolchain != "this" {
422+
if version < &Version::new(1, 51, 0) {
425423
check_lock!(tc_result, "bar", which, behavior.bar, "1.0.2");
426424
check_lock!(tc_result, "baz", which, behavior.baz, "1.0.1");
427425
check_lock!(tc_result, "new-baz-dep", which, behavior.new_baz_dep, None);
428-
} else {
426+
} else if version >= &Version::new(1, 51, 0) && version <= &Version::new(1, 59, 0) {
429427
check_lock!(tc_result, "bar", which, behavior.bar, "1.0.0");
430428
check_lock!(tc_result, "baz", which, behavior.baz, None);
431429
check_lock!(tc_result, "new-baz-dep", which, behavior.new_baz_dep, None);
432430
}
431+
// Starting with 1.60, namespaced-features has been stabilized.
432+
else {
433+
check_lock!(tc_result, "bar", which, behavior.bar, "1.0.2");
434+
check_lock!(tc_result, "baz", which, behavior.baz, "1.0.1");
435+
check_lock!(
436+
tc_result,
437+
"new-baz-dep",
438+
which,
439+
behavior.new_baz_dep,
440+
"1.0.0"
441+
);
442+
}
433443
}
434444
Err(e) => {
435445
tc_result.push(format!("unlocked build failed: {}", e));
@@ -458,40 +468,48 @@ fn new_features() {
458468
check_lock!(tc_result, "new-baz-dep", which, behavior.new_baz_dep, None);
459469
}
460470
Err(e) => {
461-
if version >= &Version::new(1, 51, 0) || toolchain == "this" {
462-
// 1.0.1 can't be used without -Znamespaced-features
463-
// It gets filtered out of the index.
464-
check_err_contains(
465-
&mut tc_result,
466-
e,
467-
"candidate versions found which didn't match: 1.0.2, 1.0.0",
468-
);
469-
} else {
470-
tc_result.push(format!("bar 1.0.1 locked build failed: {}", e));
471-
}
471+
// When version >= 1.51 and <= 1.59,
472+
// 1.0.1 can't be used without -Znamespaced-features
473+
// It gets filtered out of the index.
474+
check_err_contains(
475+
&mut tc_result,
476+
e,
477+
"candidate versions found which didn't match: 1.0.2, 1.0.0",
478+
);
472479
}
473480
}
474481

475482
let which = "locked bar 1.0.2";
476483
lock_bar_to(version, 102);
477484
match run_cargo() {
478485
Ok(behavior) => {
479-
check_lock!(tc_result, "bar", which, behavior.bar, "1.0.2");
480-
check_lock!(tc_result, "baz", which, behavior.baz, "1.0.1");
481-
check_lock!(tc_result, "new-baz-dep", which, behavior.new_baz_dep, None);
482-
}
483-
Err(e) => {
484-
if version >= &Version::new(1, 51, 0) || toolchain == "this" {
485-
// baz can't lock to 1.0.1, it requires -Znamespaced-features
486-
check_err_contains(
487-
&mut tc_result,
488-
e,
489-
"candidate versions found which didn't match: 1.0.0",
486+
if version <= &Version::new(1, 59, 0) {
487+
check_lock!(tc_result, "bar", which, behavior.bar, "1.0.2");
488+
check_lock!(tc_result, "baz", which, behavior.baz, "1.0.1");
489+
check_lock!(tc_result, "new-baz-dep", which, behavior.new_baz_dep, None);
490+
}
491+
// Starting with 1.60, namespaced-features has been stabilized.
492+
else {
493+
check_lock!(tc_result, "bar", which, behavior.bar, "1.0.2");
494+
check_lock!(tc_result, "baz", which, behavior.baz, "1.0.1");
495+
check_lock!(
496+
tc_result,
497+
"new-baz-dep",
498+
which,
499+
behavior.new_baz_dep,
500+
"1.0.0"
490501
);
491-
} else {
492-
tc_result.push(format!("bar 1.0.2 locked build failed: {}", e));
493502
}
494503
}
504+
Err(e) => {
505+
// When version >= 1.51 and <= 1.59,
506+
// baz can't lock to 1.0.1, it requires -Znamespaced-features
507+
check_err_contains(
508+
&mut tc_result,
509+
e,
510+
"candidate versions found which didn't match: 1.0.0",
511+
);
512+
}
495513
}
496514

497515
unexpected_results.push(tc_result);

0 commit comments

Comments
 (0)