Skip to content

Commit 0b448a6

Browse files
committed
Test for issue #2064
1 parent a14ddf3 commit 0b448a6

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

tests/resolve.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ extern crate cargo;
55

66
use std::collections::HashMap;
77

8-
use hamcrest::{assert_that, equal_to, contains};
8+
use hamcrest::{assert_that, equal_to, contains, not};
99

1010
use cargo::core::source::{SourceId, GitReference};
1111
use cargo::core::dependency::Kind::{self, Development};
@@ -237,6 +237,27 @@ fn resolving_with_specific_version() {
237237
("foo", "1.0.1")])));
238238
}
239239

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+
240261
#[test]
241262
fn resolving_incompat_versions() {
242263
let mut reg = registry(vec![

0 commit comments

Comments
 (0)