Skip to content

Commit

Permalink
Add regression test for markup splitting line end
Browse files Browse the repository at this point in the history
Closes dotnet#637
  • Loading branch information
sharwell committed Dec 23, 2020
1 parent 8b4a42a commit d783311
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -375,5 +375,23 @@ public void CDataMarkup2()
Assert.True(spans.TryGetValue(string.Empty, out var unnamed));
Assert.Equal(new[] { new TextSpan(0, 9), new TextSpan(13, 3) }, unnamed);
}

[Fact]
[WorkItem(637, "https://github.com/dotnet/roslyn-sdk/issues/637")]
public void MarkupSpanSplitsEndOfLine()
{
var markup = "class C { }\r{|b:\n|}";
var expected = "class C { }\r\n";
TestFileMarkupParser.GetPositionsAndSpans(markup, out var result, out var positions, out ImmutableDictionary<string, ImmutableArray<TextSpan>> spans);
Assert.Equal(expected, result);

Assert.Empty(positions);
Assert.Single(spans);

Assert.True(spans.TryGetValue("b", out var named));
Assert.Equal(new[] { new TextSpan(12, 1) }, named);

Assert.False(spans.TryGetValue(string.Empty, out _));
}
}
}

0 comments on commit d783311

Please sign in to comment.