File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -1536,3 +1536,48 @@ fn report_behind() {
1536
1536
)
1537
1537
. run ( ) ;
1538
1538
}
1539
+
1540
+ #[ cargo_test]
1541
+ fn update_with_missing_feature ( ) {
1542
+ // Attempting to update a package to a version with a missing feature
1543
+ // should produce a warning.
1544
+ Package :: new ( "bar" , "0.1.0" ) . feature ( "feat1" , & [ ] ) . publish ( ) ;
1545
+
1546
+ let p = project ( )
1547
+ . file (
1548
+ "Cargo.toml" ,
1549
+ r#"
1550
+ [package]
1551
+ name = "foo"
1552
+ version = "0.1.0"
1553
+
1554
+ [dependencies]
1555
+ bar = {version="0.1", features=["feat1"]}
1556
+ "# ,
1557
+ )
1558
+ . file ( "src/lib.rs" , "" )
1559
+ . build ( ) ;
1560
+ p. cargo ( "generate-lockfile" ) . run ( ) ;
1561
+
1562
+ // Publish an update that is missing the feature.
1563
+ Package :: new ( "bar" , "0.1.1" ) . publish ( ) ;
1564
+
1565
+ p. cargo ( "update" )
1566
+ . with_stderr (
1567
+ "\
1568
+ [UPDATING] `[..]` index
1569
+ " ,
1570
+ )
1571
+ . run ( ) ;
1572
+
1573
+ // Publish a fixed version, should not warn.
1574
+ Package :: new ( "bar" , "0.1.2" ) . feature ( "feat1" , & [ ] ) . publish ( ) ;
1575
+ p. cargo ( "update" )
1576
+ . with_stderr (
1577
+ "\
1578
+ [UPDATING] `[..]` index
1579
+ [UPDATING] bar v0.1.0 -> v0.1.2
1580
+ " ,
1581
+ )
1582
+ . run ( ) ;
1583
+ }
You can’t perform that action at this time.
0 commit comments