@@ -513,3 +513,71 @@ in the future.
513513[FINISHED] debug [unoptimized + debuginfo] target(s) in [..]
514514" ) ) ;
515515}
516+
517+ #[ test]
518+ fn ambiguous_git_reference ( ) {
519+ let foo = project ( "foo" )
520+ . file ( "Cargo.toml" , r#"
521+ [package]
522+ name = "foo"
523+ version = "0.0.0"
524+ authors = []
525+
526+ [dependencies.bar]
527+ git = "https://example.com"
528+ branch = "master"
529+ tag = "some-tag"
530+ "# )
531+ . file ( "src/lib.rs" , "" ) ;
532+
533+ assert_that ( foo. cargo_process ( "build" ) . arg ( "-v" ) ,
534+ execs ( ) . with_stderr_contains ( "\
535+ [WARNING] dependency (bar) specification is ambiguous. \
536+ Only one of `branch`, `tag` or `rev` is allowed. \
537+ This will be considered an error in future versions
538+ " ) ) ;
539+ }
540+
541+ #[ test]
542+ fn both_git_and_path_specified ( ) {
543+ let foo = project ( "foo" )
544+ . file ( "Cargo.toml" , r#"
545+ [package]
546+ name = "foo"
547+ version = "0.0.0"
548+ authors = []
549+
550+ [dependencies.bar]
551+ git = "https://example.com"
552+ path = "bar"
553+ "# )
554+ . file ( "src/lib.rs" , "" ) ;
555+
556+ assert_that ( foo. cargo_process ( "build" ) . arg ( "-v" ) ,
557+ execs ( ) . with_stderr_contains ( "\
558+ [WARNING] dependency (bar) specification is ambiguous. \
559+ Only one of `git` or `path` is allowed. \
560+ This will be considered an error in future versions
561+ " ) ) ;
562+ }
563+
564+ #[ test]
565+ fn ignored_git_revision ( ) {
566+ let foo = project ( "foo" )
567+ . file ( "Cargo.toml" , r#"
568+ [package]
569+ name = "foo"
570+ version = "0.0.0"
571+ authors = []
572+
573+ [dependencies.bar]
574+ path = "bar"
575+ branch = "spam"
576+ "# )
577+ . file ( "src/lib.rs" , "" ) ;
578+
579+ assert_that ( foo. cargo_process ( "build" ) . arg ( "-v" ) ,
580+ execs ( ) . with_stderr_contains ( "\
581+ [WARNING] key `branch` is ignored for dependency (bar). \
582+ This will be considered an error in future versions") ) ;
583+ }
0 commit comments