From: Klaus Purer Date: Fri, 23 Mar 2018 19:06:49 +0000 (+0100) Subject: tests(resolver): Group integration test with other minimal version test X-Git-Tag: archive/raspbian/0.35.0-2+rpi1~3^2^2^2^2^2^2^2~22^2~2^2~13^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=a38184ffe95f93481c3a02abd5b3f06c87434c32;p=cargo.git tests(resolver): Group integration test with other minimal version test --- diff --git a/tests/testsuite/generate_lockfile.rs b/tests/testsuite/generate_lockfile.rs index 69476315f..6018904f0 100644 --- a/tests/testsuite/generate_lockfile.rs +++ b/tests/testsuite/generate_lockfile.rs @@ -250,38 +250,3 @@ fn cargo_update_generate_lockfile() { assert_that(p.cargo("update"), execs().with_status(0).with_stdout("")); assert_that(&lockfile, existing_file()); } - -// Ensure that the "-Z minimal-versions" CLI option works and the minimal -// version of a dependency ends up in the lock file. -#[test] -fn install_minimal_version() { - Package::new("dep", "1.0.0").publish(); - Package::new("dep", "1.1.0").publish(); - - let p = project("foo") - .file( - "Cargo.toml", - r#" - [package] - name = "foo" - authors = [] - version = "0.0.1" - - [dependencies] - dep = "1.0" - "#, - ) - .file("src/main.rs", "fn main() {}") - .build(); - - assert_that( - p.cargo("generate-lockfile") - .masquerade_as_nightly_cargo() - .arg("-Zminimal-versions"), - execs().with_status(0), - ); - - let lock = p.read_lockfile(); - - assert!(lock.contains("dep 1.0.0")); -} diff --git a/tests/testsuite/resolve.rs b/tests/testsuite/resolve.rs index 38ac58e5c..55f88b8dc 100644 --- a/tests/testsuite/resolve.rs +++ b/tests/testsuite/resolve.rs @@ -8,6 +8,10 @@ use cargo::core::{Dependency, PackageId, Registry, Summary}; use cargo::util::{CargoResult, Config, ToUrl}; use cargo::core::resolver::{self, Method}; +use cargotest::ChannelChanger; +use cargotest::support::{execs, project}; +use cargotest::support::registry::Package; + fn resolve( pkg: &PackageId, deps: Vec, @@ -375,6 +379,41 @@ fn test_resolving_minimum_version_with_transitive_deps() { assert_that(&res, is_not(contains(names(&[("util", "1.0.0")])))); } +// Ensure that the "-Z minimal-versions" CLI option works and the minimal +// version of a dependency ends up in the lock file. +#[test] +fn minimal_version_cli() { + Package::new("dep", "1.0.0").publish(); + Package::new("dep", "1.1.0").publish(); + + let p = project("foo") + .file( + "Cargo.toml", + r#" + [package] + name = "foo" + authors = [] + version = "0.0.1" + + [dependencies] + dep = "1.0" + "#, + ) + .file("src/main.rs", "fn main() {}") + .build(); + + assert_that( + p.cargo("generate-lockfile") + .masquerade_as_nightly_cargo() + .arg("-Zminimal-versions"), + execs().with_status(0), + ); + + let lock = p.read_lockfile(); + + assert!(lock.contains("dep 1.0.0")); +} + #[test] fn resolving_incompat_versions() { let reg = registry(vec![