Skip to content

Commit 6015133

Browse files
committed
Auto merge of #8692 - yaymukund:improve-tests-json-diffing, r=alexcrichton
Display formatted output for JSON diffing in tests. This affects all tests that use `validate_upload`. Before <img src="https://user-images.githubusercontent.com/590450/92583169-da972000-f289-11ea-9f27-f09071a023b1.png" width="400"> After <img src="https://user-images.githubusercontent.com/590450/92583195-e2ef5b00-f289-11ea-9ee5-a32f630a6472.png" width="400">
2 parents 2c10f26 + 8d610e1 commit 6015133

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crates/cargo-test-support/src/publish.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ fn _validate_upload(
7575
f.read_exact(&mut json_bytes).expect("read JSON data");
7676
let actual_json = serde_json::from_slice(&json_bytes).expect("uploaded JSON should be valid");
7777
let expected_json = serde_json::from_str(expected_json).expect("expected JSON does not parse");
78-
find_json_mismatch(&expected_json, &actual_json)
79-
.expect("uploaded JSON did not match expected JSON");
78+
79+
if let Err(e) = find_json_mismatch(&expected_json, &actual_json) {
80+
panic!("{}", e);
81+
}
8082

8183
// 32-bit little-endian integer of length of crate file.
8284
let crate_sz = read_le_u32(&mut f).expect("read crate length");

0 commit comments

Comments
 (0)