Skip to content

Commit a38184f

Browse files
committed
tests(resolver): Group integration test with other minimal version test
1 parent 131c3e2 commit a38184f

File tree

2 files changed

+39
-35
lines changed

2 files changed

+39
-35
lines changed

tests/testsuite/generate_lockfile.rs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -250,38 +250,3 @@ fn cargo_update_generate_lockfile() {
250250
assert_that(p.cargo("update"), execs().with_status(0).with_stdout(""));
251251
assert_that(&lockfile, existing_file());
252252
}
253-
254-
// Ensure that the "-Z minimal-versions" CLI option works and the minimal
255-
// version of a dependency ends up in the lock file.
256-
#[test]
257-
fn install_minimal_version() {
258-
Package::new("dep", "1.0.0").publish();
259-
Package::new("dep", "1.1.0").publish();
260-
261-
let p = project("foo")
262-
.file(
263-
"Cargo.toml",
264-
r#"
265-
[package]
266-
name = "foo"
267-
authors = []
268-
version = "0.0.1"
269-
270-
[dependencies]
271-
dep = "1.0"
272-
"#,
273-
)
274-
.file("src/main.rs", "fn main() {}")
275-
.build();
276-
277-
assert_that(
278-
p.cargo("generate-lockfile")
279-
.masquerade_as_nightly_cargo()
280-
.arg("-Zminimal-versions"),
281-
execs().with_status(0),
282-
);
283-
284-
let lock = p.read_lockfile();
285-
286-
assert!(lock.contains("dep 1.0.0"));
287-
}

tests/testsuite/resolve.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ use cargo::core::{Dependency, PackageId, Registry, Summary};
88
use cargo::util::{CargoResult, Config, ToUrl};
99
use cargo::core::resolver::{self, Method};
1010

11+
use cargotest::ChannelChanger;
12+
use cargotest::support::{execs, project};
13+
use cargotest::support::registry::Package;
14+
1115
fn resolve(
1216
pkg: &PackageId,
1317
deps: Vec<Dependency>,
@@ -375,6 +379,41 @@ fn test_resolving_minimum_version_with_transitive_deps() {
375379
assert_that(&res, is_not(contains(names(&[("util", "1.0.0")]))));
376380
}
377381

382+
// Ensure that the "-Z minimal-versions" CLI option works and the minimal
383+
// version of a dependency ends up in the lock file.
384+
#[test]
385+
fn minimal_version_cli() {
386+
Package::new("dep", "1.0.0").publish();
387+
Package::new("dep", "1.1.0").publish();
388+
389+
let p = project("foo")
390+
.file(
391+
"Cargo.toml",
392+
r#"
393+
[package]
394+
name = "foo"
395+
authors = []
396+
version = "0.0.1"
397+
398+
[dependencies]
399+
dep = "1.0"
400+
"#,
401+
)
402+
.file("src/main.rs", "fn main() {}")
403+
.build();
404+
405+
assert_that(
406+
p.cargo("generate-lockfile")
407+
.masquerade_as_nightly_cargo()
408+
.arg("-Zminimal-versions"),
409+
execs().with_status(0),
410+
);
411+
412+
let lock = p.read_lockfile();
413+
414+
assert!(lock.contains("dep 1.0.0"));
415+
}
416+
378417
#[test]
379418
fn resolving_incompat_versions() {
380419
let reg = registry(vec![

0 commit comments

Comments
 (0)