@@ -590,6 +590,104 @@ required by package `foo v0.0.1 ([..])`
590590 . run ( ) ;
591591}
592592
593+ #[ test]
594+ fn yanks_in_lockfiles_are_ok_for_other_update ( ) {
595+ let p = project ( )
596+ . file (
597+ "Cargo.toml" ,
598+ r#"
599+ [project]
600+ name = "foo"
601+ version = "0.0.1"
602+ authors = []
603+
604+ [dependencies]
605+ bar = "*"
606+ baz = "*"
607+ "# ,
608+ )
609+ . file ( "src/main.rs" , "fn main() {}" )
610+ . build ( ) ;
611+
612+ Package :: new ( "bar" , "0.0.1" ) . publish ( ) ;
613+ Package :: new ( "baz" , "0.0.1" ) . publish ( ) ;
614+
615+ p. cargo ( "build" ) . run ( ) ;
616+
617+ registry_path ( ) . join ( "3" ) . rm_rf ( ) ;
618+
619+ Package :: new ( "bar" , "0.0.1" ) . yanked ( true ) . publish ( ) ;
620+ Package :: new ( "baz" , "0.0.1" ) . publish ( ) ;
621+
622+ p. cargo ( "build" ) . with_stdout ( "" ) . run ( ) ;
623+
624+ Package :: new ( "baz" , "0.0.2" ) . publish ( ) ;
625+
626+ p. cargo ( "update" )
627+ . with_status ( 101 )
628+ . with_stderr_contains (
629+ "\
630+ error: no matching package named `bar` found
631+ location searched: registry [..]
632+ required by package `foo v0.0.1 ([..])`
633+ " ,
634+ )
635+ . run ( ) ;
636+
637+ p. cargo ( "update -p baz" )
638+ . with_status ( 101 )
639+ . with_stderr_contains (
640+ "\
641+ [UPDATING] `[..]` index
642+ [UPDATING] baz v0.0.1 -> v0.0.2
643+ " ,
644+ )
645+ . run ( ) ;
646+ }
647+
648+ #[ test]
649+ fn yanks_in_lockfiles_are_ok_with_new_dep ( ) {
650+ let p = project ( )
651+ . file (
652+ "Cargo.toml" ,
653+ r#"
654+ [project]
655+ name = "foo"
656+ version = "0.0.1"
657+ authors = []
658+
659+ [dependencies]
660+ bar = "*"
661+ "# ,
662+ )
663+ . file ( "src/main.rs" , "fn main() {}" )
664+ . build ( ) ;
665+
666+ Package :: new ( "bar" , "0.0.1" ) . publish ( ) ;
667+
668+ p. cargo ( "build" ) . run ( ) ;
669+
670+ registry_path ( ) . join ( "3" ) . rm_rf ( ) ;
671+
672+ Package :: new ( "bar" , "0.0.1" ) . yanked ( true ) . publish ( ) ;
673+ Package :: new ( "baz" , "0.0.1" ) . publish ( ) ;
674+
675+ t ! ( t!( File :: create( p. root( ) . join( "Cargo.toml" ) ) ) . write_all(
676+ br#"
677+ [project]
678+ name = "foo"
679+ version = "0.0.1"
680+ authors = []
681+
682+ [dependencies]
683+ bar = "*"
684+ baz = "*"
685+ "#
686+ ) ) ;
687+
688+ p. cargo ( "build" ) . with_stdout ( "" ) . run ( ) ;
689+ }
690+
593691#[ test]
594692fn update_with_lockfile_if_packages_missing ( ) {
595693 let p = project ( )
0 commit comments