Skip to content

Commit

Permalink
Add failing tests & fix them
Browse files Browse the repository at this point in the history
  • Loading branch information
In-line committed Apr 30, 2021
1 parent 381e77d commit 1439dab
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/core/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ impl<'cfg> Workspace<'cfg> {
summary_features
.into_iter()
.filter(|summary_feature| {
levenshtein_test(**summary_feature, *dep_name)
levenshtein_test(**summary_feature, *dep_feature)
})
.map(move |summary_feature| {
format!("{}/{}", package.name(), summary_feature)
Expand Down
38 changes: 38 additions & 0 deletions tests/testsuite/package_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,44 @@ fn virtual_no_default_features() {
.with_status(101)
.with_stderr("[ERROR] none of the selected packages contains these features: b/f2, f2, did you mean: f1?")
.run();

p.cargo("check --features a/dep,b/f1,b/f2,f2")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr("[ERROR] none of the selected packages contains these features: a/dep, b/f2, f2, did you mean: a/dep1, f1?")
.run();

p.cargo("check --features a/dep,a/dep1")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr("[ERROR] none of the selected packages contains these features: a/dep, did you mean: b/f1?")
.run();
}

#[cargo_test]
fn virtual_typo_member_feature() {
project()
.file(
"Cargo.toml",
r#"
[package]
name = "a"
version = "0.1.0"
resolver = "2"
[features]
deny-warnings = []
"#,
)
.file("src/lib.rs", "")
.build()
.cargo("check --features a/deny-warning")
.masquerade_as_nightly_cargo()
.with_status(101)
.with_stderr(
"[ERROR] none of the selected packages contains these features: a/deny-warning, did you mean: a/deny-warnings?",
)
.run();
}

#[cargo_test]
Expand Down

0 comments on commit 1439dab

Please sign in to comment.