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"));
-}
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>,
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![