@@ -73,7 +73,7 @@ fn missing_version() {
7373 error: failed to parse manifest at `[..]`
7474
7575Caused by:
76- replacements must specify a version to replace, but `foo` does not
76+ replacements must specify a version to replace, but `[..] foo` does not
7777" ) ) ;
7878}
7979
@@ -468,7 +468,7 @@ fn override_wrong_name() {
468468 execs ( ) . with_status ( 101 ) . with_stderr ( "\
469469 [UPDATING] registry [..]
470470[UPDATING] git repository [..]
471- error: no matching package for override `foo:0.1.0` found
471+ error: no matching package for override `[..] foo:0.1.0` found
472472location searched: file://[..]
473473version required: = 0.1.0
474474" ) ) ;
@@ -530,7 +530,7 @@ fn override_wrong_version() {
530530 error: failed to parse manifest at `[..]`
531531
532532Caused by:
533- replacements cannot specify a version requirement, but found one for `foo:0.1.0`
533+ replacements cannot specify a version requirement, but found one for `[..] foo:0.1.0`
534534" ) ) ;
535535}
536536
@@ -875,3 +875,53 @@ fn override_an_override() {
875875 assert_that ( p. cargo_process ( "build" ) . arg ( "-v" ) ,
876876 execs ( ) . with_status ( 0 ) ) ;
877877}
878+
879+ #[ test]
880+ fn overriding_nonexistent_no_spurious ( ) {
881+ Package :: new ( "foo" , "0.1.0" ) . dep ( "bar" , "0.1" ) . publish ( ) ;
882+ Package :: new ( "bar" , "0.1.0" ) . publish ( ) ;
883+
884+ let foo = git:: repo ( & paths:: root ( ) . join ( "override" ) )
885+ . file ( "Cargo.toml" , r#"
886+ [package]
887+ name = "foo"
888+ version = "0.1.0"
889+ authors = []
890+
891+ [dependencies]
892+ bar = { path = "bar" }
893+ "# )
894+ . file ( "src/lib.rs" , "pub fn foo() {}" )
895+ . file ( "bar/Cargo.toml" , r#"
896+ [package]
897+ name = "bar"
898+ version = "0.1.0"
899+ authors = []
900+ "# )
901+ . file ( "bar/src/lib.rs" , "pub fn foo() {}" ) ;
902+ foo. build ( ) ;
903+
904+
905+ let p = project ( "local" )
906+ . file ( "Cargo.toml" , & format ! ( r#"
907+ [package]
908+ name = "local"
909+ version = "0.0.1"
910+ authors = []
911+
912+ [dependencies]
913+ foo = "0.1.0"
914+
915+ [replace]
916+ "foo:0.1.0" = {{ git = '{url}' }}
917+ "bar:0.1.0" = {{ git = '{url}' }}
918+ "# , url = foo. url( ) ) )
919+ . file ( "src/lib.rs" , "" ) ;
920+
921+ assert_that ( p. cargo_process ( "build" ) ,
922+ execs ( ) . with_status ( 0 ) ) ;
923+ assert_that ( p. cargo ( "build" ) ,
924+ execs ( ) . with_status ( 0 ) . with_stderr ( "\
925+ [FINISHED] [..]
926+ " ) . with_stdout ( "" ) ) ;
927+ }
0 commit comments