Skip to content

Commit

Permalink
Ignore new line differences in tests
Browse files Browse the repository at this point in the history
If the test source, and thus the test contents is using a different new
line sequence than the system, these tests will fail because the output
will differ by the new lines. Flatten new lines into a single new line
format before testing for equality.
  • Loading branch information
mispencer authored and david-driscoll committed Jan 21, 2016
1 parent b99823c commit ed315d1
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions tests/OmniSharp.Roslyn.CSharp.Tests/FixUsingsFacts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -433,14 +433,11 @@ public void method1()
private async Task AssertBufferContents(string fileContents, string expectedFileContents)
{
var response = await RunFixUsings(fileContents);
if (PlatformServices.Default.Runtime.OperatingSystem == "Windows")
{
Assert.Equal(expectedFileContents, response.Buffer);
}
else
{
Assert.Equal(expectedFileContents, response.Buffer.Replace("\r\n", "\n"));
}
Assert.Equal(FlattenNewLines(expectedFileContents), FlattenNewLines(response.Buffer));
}

private string FlattenNewLines(string input) {
return input.Replace("\r\n", "\n");
}

private async Task AssertUnresolvedReferences(string fileContents, List<QuickFix> expectedUnresolved)
Expand Down

0 comments on commit ed315d1

Please sign in to comment.