@@ -5,7 +5,7 @@ extern crate cargo;
5
5
6
6
use std:: collections:: HashMap ;
7
7
8
- use hamcrest:: { assert_that, equal_to, contains} ;
8
+ use hamcrest:: { assert_that, equal_to, contains, not } ;
9
9
10
10
use cargo:: core:: source:: { SourceId , GitReference } ;
11
11
use cargo:: core:: dependency:: Kind :: { self , Development } ;
@@ -237,6 +237,27 @@ fn resolving_with_specific_version() {
237
237
( "foo" , "1.0.1" ) ] ) ) ) ;
238
238
}
239
239
240
+ #[ test]
241
+ fn test_resolving_maximum_version_with_transitive_deps ( ) {
242
+ let mut reg = registry ( vec ! [
243
+ pkg!( ( "util" , "1.2.2" ) ) ,
244
+ pkg!( ( "util" , "1.0.0" ) ) ,
245
+ pkg!( ( "util" , "1.1.1" ) ) ,
246
+ pkg!( "foo" => [ dep_req( "util" , "1.0.0" ) ] ) ,
247
+ pkg!( "bar" => [ dep_req( "util" , ">=1.0.1" ) ] ) ,
248
+ ] ) ;
249
+
250
+ let res = resolve ( pkg_id ( "root" ) , vec ! [ dep_req( "foo" , "1.0.0" ) , dep_req( "bar" , "1.0.0" ) ] ,
251
+ & mut reg) . unwrap ( ) ;
252
+
253
+ assert_that ( & res, contains ( names ( & [ ( "root" , "1.0.0" ) ,
254
+ ( "foo" , "1.0.0" ) ,
255
+ ( "bar" , "1.0.0" ) ,
256
+ ( "util" , "1.2.2" ) ] ) ) ) ;
257
+ assert_that ( & res, not ( contains ( names ( & [ ( "util" , "1.0.1" ) ] ) ) ) ) ;
258
+ assert_that ( & res, not ( contains ( names ( & [ ( "util" , "1.1.1" ) ] ) ) ) ) ;
259
+ }
260
+
240
261
#[ test]
241
262
fn resolving_incompat_versions ( ) {
242
263
let mut reg = registry ( vec ! [
0 commit comments