From 85b26e97886ef1e2b1dc10979ff31df97afa4d20 Mon Sep 17 00:00:00 2001 From: Thorsten Ball Date: Tue, 23 Apr 2024 19:13:04 +0200 Subject: [PATCH] Store goldenfiles with trailing newline (#10900) Release Notes: - N/A --- crates/git/src/blame.rs | 4 +++- crates/git/test_data/golden/blame_incremental_complex.json | 2 +- .../git/test_data/golden/blame_incremental_not_committed.json | 2 +- crates/git/test_data/golden/blame_incremental_simple.json | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/git/src/blame.rs b/crates/git/src/blame.rs index bb86cb4275..6b9848609d 100644 --- a/crates/git/src/blame.rs +++ b/crates/git/src/blame.rs @@ -336,8 +336,10 @@ mod tests { path.push("golden"); path.push(format!("{}.json", golden_filename)); - let have_json = + let mut have_json = serde_json::to_string_pretty(&entries).expect("could not serialize entries to JSON"); + // We always want to save with a trailing newline. + have_json.push('\n'); let update = std::env::var("UPDATE_GOLDEN") .map(|val| val.to_ascii_lowercase() == "true") diff --git a/crates/git/test_data/golden/blame_incremental_complex.json b/crates/git/test_data/golden/blame_incremental_complex.json index 84d49d847b..3eb6ec81e3 100644 --- a/crates/git/test_data/golden/blame_incremental_complex.json +++ b/crates/git/test_data/golden/blame_incremental_complex.json @@ -778,4 +778,4 @@ "previous": null, "filename": "crates/vim/src/utils.rs" } -] \ No newline at end of file +] diff --git a/crates/git/test_data/golden/blame_incremental_not_committed.json b/crates/git/test_data/golden/blame_incremental_not_committed.json index 0298fb05d3..4e4834d45c 100644 --- a/crates/git/test_data/golden/blame_incremental_not_committed.json +++ b/crates/git/test_data/golden/blame_incremental_not_committed.json @@ -132,4 +132,4 @@ "previous": null, "filename": "file_b.txt" } -] \ No newline at end of file +] diff --git a/crates/git/test_data/golden/blame_incremental_simple.json b/crates/git/test_data/golden/blame_incremental_simple.json index 4d6e9124d6..c8fba83897 100644 --- a/crates/git/test_data/golden/blame_incremental_simple.json +++ b/crates/git/test_data/golden/blame_incremental_simple.json @@ -132,4 +132,4 @@ "previous": null, "filename": "index.js" } -] \ No newline at end of file +]