Skip to content

Commit d4b3b9d

Browse files
committed
test(fix): Show virtual manifest migration issue
1 parent 05f54fd commit d4b3b9d

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed

tests/testsuite/fix.rs

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,6 +2643,79 @@ a = {path = "a", default-features = false}
26432643
);
26442644
}
26452645

2646+
#[cargo_test]
2647+
fn migrate_rename_underscore_fields_in_virtual_manifest() {
2648+
let p = project()
2649+
.file(
2650+
"Cargo.toml",
2651+
r#"
2652+
[workspace]
2653+
members = ["foo"]
2654+
resolver = "2"
2655+
2656+
[workspace.dependencies]
2657+
# Before default_features
2658+
a = {path = "a", default_features = false} # After default_features value
2659+
# After default_features line
2660+
"#,
2661+
)
2662+
.file(
2663+
"foo/Cargo.toml",
2664+
r#"
2665+
[package]
2666+
name = "foo"
2667+
edition = "2021"
2668+
"#,
2669+
)
2670+
.file("foo/src/lib.rs", "")
2671+
.file(
2672+
"a/Cargo.toml",
2673+
r#"
2674+
[package]
2675+
name = "a"
2676+
version = "0.0.1"
2677+
edition = "2015"
2678+
"#,
2679+
)
2680+
.file("a/src/lib.rs", "")
2681+
.build();
2682+
2683+
p.cargo("fix --edition --allow-no-vcs")
2684+
.with_stderr_data(str![[r#"
2685+
[MIGRATING] foo/Cargo.toml from 2021 edition to 2024
2686+
[CHECKING] foo v0.0.0 ([ROOT]/foo/foo)
2687+
[MIGRATING] foo/src/lib.rs from 2021 edition to 2024
2688+
[FINISHED] `dev` profile [unoptimized + debuginfo] target(s) in [ELAPSED]s
2689+
2690+
"#]])
2691+
.run();
2692+
assert_e2e().eq(
2693+
p.read_file("Cargo.toml"),
2694+
str![[r#"
2695+
2696+
[workspace]
2697+
members = ["foo"]
2698+
resolver = "2"
2699+
2700+
[workspace.dependencies]
2701+
# Before default_features
2702+
a = {path = "a", default_features = false} # After default_features value
2703+
# After default_features line
2704+
2705+
"#]],
2706+
);
2707+
assert_e2e().eq(
2708+
p.read_file("foo/Cargo.toml"),
2709+
str![[r#"
2710+
2711+
[package]
2712+
name = "foo"
2713+
edition = "2021"
2714+
2715+
"#]],
2716+
);
2717+
}
2718+
26462719
#[cargo_test]
26472720
fn remove_ignored_default_features() {
26482721
Package::new("dep_simple", "0.1.0").publish();

0 commit comments

Comments
 (0)