Skip to content

Commit d618164

Browse files
committed
Add test for empty feature name
Signed-off-by: hi-rustin <[email protected]>
1 parent dd3f434 commit d618164

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Diff for: tests/testsuite/features.rs

+31
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,37 @@ Caused by:
3535
.run();
3636
}
3737

38+
#[cargo_test]
39+
fn empty_feature_name() {
40+
let p = project()
41+
.file(
42+
"Cargo.toml",
43+
r#"
44+
[package]
45+
name = "foo"
46+
version = "0.0.1"
47+
authors = []
48+
49+
[features]
50+
"" = []
51+
"#,
52+
)
53+
.file("src/main.rs", "")
54+
.build();
55+
56+
p.cargo("check")
57+
.with_status(101)
58+
.with_stderr(
59+
"\
60+
[ERROR] failed to parse manifest at `[..]`
61+
62+
Caused by:
63+
feature name cannot be empty
64+
",
65+
)
66+
.run();
67+
}
68+
3869
#[cargo_test]
3970
fn same_name() {
4071
// Feature with the same name as a dependency.

0 commit comments

Comments
 (0)