Skip to content

Commit

Permalink
Fixes tests where line-endings mismatched due to git autocrlf
Browse files Browse the repository at this point in the history
  • Loading branch information
boukeversteegh committed Jan 11, 2022
1 parent cfa4fa3 commit 3dfd683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions csharp/src/Google.Protobuf.Test/JsonFormatterTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,12 @@ private static void AssertWriteValue(object value, string expectedJson, JsonForm

/// <summary>
/// Checks that the actual JSON is the same as the expected JSON - but after replacing
/// all apostrophes in the expected JSON with double quotes and trimming leading whitespace.
/// all apostrophes in the expected JSON with double quotes, trimming leading whitespace and normalizing new lines.
/// This basically makes the tests easier to read.
/// </summary>
private static void AssertJson(string expectedJsonWithApostrophes, string actualJson)
{
var expectedJson = expectedJsonWithApostrophes.Replace("'", "\"").TrimStart();
var expectedJson = expectedJsonWithApostrophes.Replace("'", "\"").Replace("\r\n", "\n").TrimStart();
Assert.AreEqual(expectedJson, actualJson);
}
}
Expand Down

0 comments on commit 3dfd683

Please sign in to comment.