]> git.proxmox.com Git - cargo.git/commitdiff
Display formatted output for JSON diffing in tests.
authorMukund Lakshman <yaymukund@gmail.com>
Wed, 9 Sep 2020 09:23:06 +0000 (10:23 +0100)
committerMukund Lakshman <yaymukund@gmail.com>
Sat, 12 Sep 2020 16:24:53 +0000 (17:24 +0100)
crates/cargo-test-support/src/publish.rs

index 36afd91a15036f8636bd3113ceb57882961f5c82..e66f1902762260a3fec3df7af944892fce254ddc 100644 (file)
@@ -75,8 +75,10 @@ fn _validate_upload(
     f.read_exact(&mut json_bytes).expect("read JSON data");
     let actual_json = serde_json::from_slice(&json_bytes).expect("uploaded JSON should be valid");
     let expected_json = serde_json::from_str(expected_json).expect("expected JSON does not parse");
-    find_json_mismatch(&expected_json, &actual_json)
-        .expect("uploaded JSON did not match expected JSON");
+
+    if let Err(e) = find_json_mismatch(&expected_json, &actual_json) {
+        panic!("{}", e);
+    }
 
     // 32-bit little-endian integer of length of crate file.
     let crate_sz = read_le_u32(&mut f).expect("read crate length");