tests(resolver): Group integration test with other minimal version test
authorKlaus Purer <klaus.purer@gmail.com>
Fri, 23 Mar 2018 19:06:49 +0000 (20:06 +0100)
committerKlaus Purer <klaus.purer@gmail.com>
Fri, 23 Mar 2018 19:06:49 +0000 (20:06 +0100)
tests/testsuite/generate_lockfile.rs
tests/testsuite/resolve.rs

index 69476315ff81e0f03237a61e48e620fbdf720d35..6018904f03fab97c09e20282b7d9996103416e29 100644 (file)
@@ -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"));
-}
index 38ac58e5c4b8de8bce6496c4ed7f4d5efc1a4b57..55f88b8dc41136e22457c9316164fdd6a3a01f9e 100644 (file)
@@ -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<Dependency>,
@@ -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![