Skip to content

Commit

Permalink
Add test of the new warning about missing features
Browse files Browse the repository at this point in the history
  • Loading branch information
peterallin committed Jan 31, 2023
1 parent bac6a9a commit 862a322
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions tests/testsuite/required_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,3 +1359,94 @@ Consider enabling them by passing, e.g., `--features=\"a1/f1\"`
.with_stdout("a1 f1\na2 f2")
.run();
}

#[cargo_test]
fn truncated_install_warning_message() {
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.1.0"
edition = "2021"
[features]
feature1 = []
feature2 = []
feature3 = []
feature4 = []
feature5 = []
[[bin]]
name = "foo1"
required-features = ["feature1", "feature2", "feature3"]
[[bin]]
name = "foo2"
required-features = ["feature2"]
[[bin]]
name = "foo3"
required-features = ["feature3"]
[[bin]]
name = "foo4"
required-features = ["feature4", "feature1"]
[[bin]]
name = "foo5"
required-features = ["feature1", "feature2", "feature3", "feature4", "feature5"]
[[bin]]
name = "foo6"
required-features = ["feature1", "feature2", "feature3", "feature4", "feature5"]
[[bin]]
name = "foo7"
required-features = ["feature1", "feature2", "feature3", "feature4", "feature5"]
[[bin]]
name = "foo8"
required-features = ["feature1", "feature2", "feature3", "feature4", "feature5"]
[[bin]]
name = "foo9"
required-features = ["feature1", "feature2", "feature3", "feature4", "feature5"]
[[bin]]
name = "foo10"
required-features = ["feature1", "feature2", "feature3", "feature4", "feature5"]
[[example]]
name = "example1"
required-features = ["feature1", "feature2"]
"#,
)
.file("src/bin/foo1.rs", "fn main() {}")
.file("src/bin/foo2.rs", "fn main() {}")
.file("src/bin/foo3.rs", "fn main() {}")
.file("src/bin/foo4.rs", "fn main() {}")
.file("src/bin/foo5.rs", "fn main() {}")
.file("src/bin/foo6.rs", "fn main() {}")
.file("src/bin/foo7.rs", "fn main() {}")
.file("src/bin/foo8.rs", "fn main() {}")
.file("src/bin/foo9.rs", "fn main() {}")
.file("src/bin/foo10.rs", "fn main() {}")
.file("examples/example1.rs", "fn main() {}")
.build();

p.cargo("install --path .").with_stderr("\
[INSTALLING] foo v0.1.0 ([..])
[FINISHED] release [optimized] target(s) in [..]
[WARNING] none of the package's binaries are available for install using the selected features
bin \"foo1\" requires the features: `feature1`, `feature2`, `feature3`
bin \"foo2\" requires the features: `feature2`
bin \"foo3\" requires the features: `feature3`
bin \"foo4\" requires the features: `feature4`, `feature1`
bin \"foo5\" requires the features: `feature1`, `feature2`, `feature3`, `feature4`, `feature5`
bin \"foo6\" requires the features: `feature1`, `feature2`, `feature3`, `feature4`, `feature5`
bin \"foo7\" requires the features: `feature1`, `feature2`, `feature3`, `feature4`, `feature5`
4 more targets also requires features not enabled. See them in the Cargo.toml file.
Consider enabling some of the needed features by passing, e.g., `--features=\"feature1 feature2 feature3\"`").run();
}

0 comments on commit 862a322

Please sign in to comment.