File tree Expand file tree Collapse file tree 1 file changed +82
-0
lines changed Expand file tree Collapse file tree 1 file changed +82
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,38 @@ Caused by:
36
36
. run ( ) ;
37
37
}
38
38
39
+ #[ cargo_test]
40
+ fn feature_activates_typoed_feature ( ) {
41
+ let p = project ( )
42
+ . file (
43
+ "Cargo.toml" ,
44
+ r#"
45
+ [package]
46
+ name = "foo"
47
+ version = "0.0.1"
48
+ edition = "2015"
49
+ authors = []
50
+
51
+ [features]
52
+ bar = ["baz"]
53
+ jaz = []
54
+ "# ,
55
+ )
56
+ . file ( "src/main.rs" , "" )
57
+ . build ( ) ;
58
+
59
+ p. cargo ( "check" )
60
+ . with_status ( 101 )
61
+ . with_stderr_data ( str![ [ r#"
62
+ [ERROR] failed to parse manifest at `[ROOT]/foo/Cargo.toml`
63
+
64
+ Caused by:
65
+ feature `bar` includes `baz` which is neither a dependency nor another feature
66
+
67
+ "# ] ] )
68
+ . run ( ) ;
69
+ }
70
+
39
71
#[ cargo_test]
40
72
fn empty_feature_name ( ) {
41
73
let p = project ( )
@@ -202,6 +234,56 @@ failed to select a version for `bar` which could resolve this conflict
202
234
. run ( ) ;
203
235
}
204
236
237
+ #[ cargo_test]
238
+ fn dependency_activates_typoed_feature ( ) {
239
+ let p = project ( )
240
+ . file (
241
+ "Cargo.toml" ,
242
+ r#"
243
+ [package]
244
+ name = "foo"
245
+ version = "0.0.1"
246
+ edition = "2015"
247
+ authors = []
248
+
249
+ [dependencies.bar]
250
+ path = "bar"
251
+ features = ["bar"]
252
+ "# ,
253
+ )
254
+ . file ( "src/main.rs" , "" )
255
+ . file (
256
+ "bar/Cargo.toml" ,
257
+ r#"
258
+ [package]
259
+ name = "bar"
260
+ version = "0.0.1"
261
+ edition = "2015"
262
+ authors = []
263
+
264
+ [features]
265
+ baz = []
266
+ "# ,
267
+ )
268
+ . file ( "bar/src/lib.rs" , "" )
269
+ . build ( ) ;
270
+
271
+ p. cargo ( "check" )
272
+ . with_status ( 101 )
273
+ . with_stderr_data ( str![ [ r#"
274
+ [ERROR] failed to select a version for `bar`.
275
+ ... required by package `foo v0.0.1 ([ROOT]/foo)`
276
+ versions that meet the requirements `*` are: 0.0.1
277
+
278
+ the package `foo` depends on `bar`, with features: `bar` but `bar` does not have these features.
279
+
280
+
281
+ failed to select a version for `bar` which could resolve this conflict
282
+
283
+ "# ] ] )
284
+ . run ( ) ;
285
+ }
286
+
205
287
#[ cargo_test]
206
288
fn optional_dev_dependency ( ) {
207
289
let p = project ( )
You can’t perform that action at this time.
0 commit comments