Skip to content

Commit

Permalink
Test for issue rust-lang#2064
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Dec 13, 2016
1 parent a14ddf3 commit 0b448a6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/resolve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ extern crate cargo;

use std::collections::HashMap;

use hamcrest::{assert_that, equal_to, contains};
use hamcrest::{assert_that, equal_to, contains, not};

use cargo::core::source::{SourceId, GitReference};
use cargo::core::dependency::Kind::{self, Development};
Expand Down Expand Up @@ -237,6 +237,27 @@ fn resolving_with_specific_version() {
("foo", "1.0.1")])));
}

#[test]
fn test_resolving_maximum_version_with_transitive_deps() {
let mut reg = registry(vec![
pkg!(("util", "1.2.2")),
pkg!(("util", "1.0.0")),
pkg!(("util", "1.1.1")),
pkg!("foo" => [dep_req("util", "1.0.0")]),
pkg!("bar" => [dep_req("util", ">=1.0.1")]),
]);

let res = resolve(pkg_id("root"), vec![dep_req("foo", "1.0.0"), dep_req("bar", "1.0.0")],
&mut reg).unwrap();

assert_that(&res, contains(names(&[("root", "1.0.0"),
("foo", "1.0.0"),
("bar", "1.0.0"),
("util", "1.2.2")])));
assert_that(&res, not(contains(names(&[("util", "1.0.1")]))));
assert_that(&res, not(contains(names(&[("util", "1.1.1")]))));
}

#[test]
fn resolving_incompat_versions() {
let mut reg = registry(vec![
Expand Down

0 comments on commit 0b448a6

Please sign in to comment.