Fix the lockfile-compat test
authorAlex Crichton <alex@alexcrichton.com>
Wed, 29 Nov 2017 01:44:25 +0000 (17:44 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 29 Nov 2017 01:44:25 +0000 (17:44 -0800)
The newest version of `tar` tweaks the checksum here slightly as the tarball is
slightly different, so this just updates the test to pull the checksum from the
publication rather than hardcoding it.

tests/lockfile-compat.rs

index 0c90fd417ad43be4000cd30f7c16a65aa91a9211..c8a16aa2ed482d10cc53898bcf3bd74d40f8d726 100644 (file)
@@ -79,9 +79,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
 
 #[test]
 fn frozen_flag_preserves_old_lockfile() {
-    Package::new("foo", "0.1.0").publish();
+    let cksum = Package::new("foo", "0.1.0").publish();
 
-    let old_lockfile =
+    let old_lockfile = format!(
         r#"[root]
 name = "zzz"
 version = "0.0.1"
@@ -95,8 +95,10 @@ version = "0.1.0"
 source = "registry+https://github.com/rust-lang/crates.io-index"
 
 [metadata]
-"checksum foo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f9e0a16bdf5c05435698fa27192d89e331b22a26a972c34984f560662544453b"
-"#;
+"checksum foo 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "{}"
+"#,
+    cksum,
+    );
 
     let p = project("bar")
         .file("Cargo.toml", r#"
@@ -109,7 +111,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
             foo = "0.1.0"
         "#)
         .file("src/lib.rs", "")
-        .file("Cargo.lock", old_lockfile)
+        .file("Cargo.lock", &old_lockfile)
         .build();
 
     assert_that(p.cargo("build").arg("--locked"),