Skip to content

Commit

Permalink
test: Show bad error for dep_name/feature_name on 2024
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 9, 2024
1 parent 6be8b34 commit e9cf4a2
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1847,6 +1847,63 @@ fn features_option_given_twice() {
p.cargo("check --features a --features b").run();
}

#[cargo_test(nightly, reason = "edition2024 is not stable")]
fn strong_dep_feature_edition2024() {
let p = project()
.file(
"Cargo.toml",
r#"
cargo-features = ["edition2024"]
[package]
name = "foo"
version = "0.1.0"
edition = "2024"
[features]
optional_dep = ["optional_dep/foo"]
[dependencies]
optional_dep = { path = "optional_dep", optional = true }
"#,
)
.file(
"src/main.rs",
r#"
fn main() {}
"#,
)
.file(
"optional_dep/Cargo.toml",
r#"
[package]
name = "optional_dep"
[features]
foo = []
"#,
)
.file(
"optional_dep/src/lib.rs",
r#"
"#,
)
.build();

p.cargo("metadata")
.masquerade_as_nightly_cargo(&["edition2024"])
.with_status(101)
.with_stderr_data(str![[r#"
[ERROR] feature `optional_dep` includes `optional_dep/foo`, but `optional_dep` is not a dependency
--> Cargo.toml:9:32
|
9 | optional_dep = ["optional_dep/foo"]
| ^^^^^^^^^^^^^^^^^^^^
|
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
"#]])
.run();
}

#[cargo_test]
fn multi_multi_features() {
let p = project()
Expand Down

0 comments on commit e9cf4a2

Please sign in to comment.