mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
test(features): Show typoed feature behavior
This commit is contained in:
parent
a1c464457b
commit
a38d44c2b0
@ -36,6 +36,38 @@ Caused by:
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn feature_activates_typoed_feature() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
authors = []
|
||||||
|
|
||||||
|
[features]
|
||||||
|
bar = ["baz"]
|
||||||
|
jaz = []
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("check")
|
||||||
|
.with_status(101)
|
||||||
|
.with_stderr_data(str![[r#"
|
||||||
|
[ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
|
||||||
|
|
||||||
|
Caused by:
|
||||||
|
feature `bar` includes `baz` which is neither a dependency nor another feature
|
||||||
|
|
||||||
|
"#]])
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn empty_feature_name() {
|
fn empty_feature_name() {
|
||||||
let p = project()
|
let p = project()
|
||||||
@ -202,6 +234,56 @@ failed to select a version for `bar` which could resolve this conflict
|
|||||||
.run();
|
.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cargo_test]
|
||||||
|
fn dependency_activates_typoed_feature() {
|
||||||
|
let p = project()
|
||||||
|
.file(
|
||||||
|
"Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "foo"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
authors = []
|
||||||
|
|
||||||
|
[dependencies.bar]
|
||||||
|
path = "bar"
|
||||||
|
features = ["bar"]
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("src/main.rs", "")
|
||||||
|
.file(
|
||||||
|
"bar/Cargo.toml",
|
||||||
|
r#"
|
||||||
|
[package]
|
||||||
|
name = "bar"
|
||||||
|
version = "0.0.1"
|
||||||
|
edition = "2015"
|
||||||
|
authors = []
|
||||||
|
|
||||||
|
[features]
|
||||||
|
baz = []
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.file("bar/src/lib.rs", "")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
p.cargo("check")
|
||||||
|
.with_status(101)
|
||||||
|
.with_stderr_data(str![[r#"
|
||||||
|
[ERROR] failed to select a version for `bar`.
|
||||||
|
... required by package `foo v0.0.1 ([ROOT]/foo)`
|
||||||
|
versions that meet the requirements `*` are: 0.0.1
|
||||||
|
|
||||||
|
the package `foo` depends on `bar`, with features: `bar` but `bar` does not have these features.
|
||||||
|
|
||||||
|
|
||||||
|
failed to select a version for `bar` which could resolve this conflict
|
||||||
|
|
||||||
|
"#]])
|
||||||
|
.run();
|
||||||
|
}
|
||||||
|
|
||||||
#[cargo_test]
|
#[cargo_test]
|
||||||
fn optional_dev_dependency() {
|
fn optional_dev_dependency() {
|
||||||
let p = project()
|
let p = project()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user