Skip to content

Commit 1439dab

Browse files
committed
Add failing tests & fix them
1 parent 381e77d commit 1439dab

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

src/cargo/core/workspace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ impl<'cfg> Workspace<'cfg> {
13001300
summary_features
13011301
.into_iter()
13021302
.filter(|summary_feature| {
1303-
levenshtein_test(**summary_feature, *dep_name)
1303+
levenshtein_test(**summary_feature, *dep_feature)
13041304
})
13051305
.map(move |summary_feature| {
13061306
format!("{}/{}", package.name(), summary_feature)

tests/testsuite/package_features.rs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,44 @@ fn virtual_no_default_features() {
7777
.with_status(101)
7878
.with_stderr("[ERROR] none of the selected packages contains these features: b/f2, f2, did you mean: f1?")
7979
.run();
80+
81+
p.cargo("check --features a/dep,b/f1,b/f2,f2")
82+
.masquerade_as_nightly_cargo()
83+
.with_status(101)
84+
.with_stderr("[ERROR] none of the selected packages contains these features: a/dep, b/f2, f2, did you mean: a/dep1, f1?")
85+
.run();
86+
87+
p.cargo("check --features a/dep,a/dep1")
88+
.masquerade_as_nightly_cargo()
89+
.with_status(101)
90+
.with_stderr("[ERROR] none of the selected packages contains these features: a/dep, did you mean: b/f1?")
91+
.run();
92+
}
93+
94+
#[cargo_test]
95+
fn virtual_typo_member_feature() {
96+
project()
97+
.file(
98+
"Cargo.toml",
99+
r#"
100+
[package]
101+
name = "a"
102+
version = "0.1.0"
103+
resolver = "2"
104+
105+
[features]
106+
deny-warnings = []
107+
"#,
108+
)
109+
.file("src/lib.rs", "")
110+
.build()
111+
.cargo("check --features a/deny-warning")
112+
.masquerade_as_nightly_cargo()
113+
.with_status(101)
114+
.with_stderr(
115+
"[ERROR] none of the selected packages contains these features: a/deny-warning, did you mean: a/deny-warnings?",
116+
)
117+
.run();
80118
}
81119

82120
#[cargo_test]

0 commit comments

Comments
 (0)