Skip to content

Commit

Permalink
Updated old lockfile tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raytung committed Oct 3, 2017
1 parent 639bfb5 commit cab464e
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions tests/lockfile-compat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ use hamcrest::assert_that;

#[test]
fn oldest_lockfile_still_works() {
let cargo_commands = vec![
"build",
"update"
];
for cargo_command in cargo_commands {
oldest_lockfile_still_works_with_command(cargo_command);
}
}

fn oldest_lockfile_still_works_with_command(cargo_command: &str) {
Package::new("foo", "0.1.0").publish();

let expected_lockfile =
Expand Down Expand Up @@ -53,24 +63,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"#)
.file("src/lib.rs", "")
.file("Cargo.lock", old_lockfile);
p.build();

let cargo_commands = vec![
"build",
"update"
];

for cargo_command in cargo_commands {
assert_that(p.cargo(cargo_command),
execs().with_status(0));
p.build();

let lock = p.read_lockfile();
for (l, r) in expected_lockfile.lines().zip(lock.lines()) {
assert!(lines_match(l, r), "Lines differ:\n{}\n\n{}", l, r);
}
assert_that(p.cargo(cargo_command),
execs().with_status(0));

assert_eq!(lock.lines().count(), expected_lockfile.lines().count());
let lock = p.read_lockfile();
for (l, r) in expected_lockfile.lines().zip(lock.lines()) {
assert!(lines_match(l, r), "Lines differ:\n{}\n\n{}", l, r);
}

assert_eq!(lock.lines().count(), expected_lockfile.lines().count());
}

#[test]
Expand Down

0 comments on commit cab464e

Please sign in to comment.