diff --git a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeVerifier.cs b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeVerifier.cs index 140fd58ed3..449d8f0428 100644 --- a/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeVerifier.cs +++ b/test/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/SyntaxTreeNodeVerifier.cs @@ -46,6 +46,13 @@ namespace Microsoft.AspNetCore.Razor.Language.Legacy _writer.GetStringBuilder().Clear(); _visitor.Visit(node); var actual = _writer.GetStringBuilder().ToString(); + var actualLineCount = actual.Split("\r\n").Length; + + var expectedLineIndex = 1; + while (expectedLineIndex++ < actualLineCount && _index < _baseline.Length) + { + expected += $"\r\n{_baseline[_index++]}"; + } AssertNodeEquals(node, Ancestors, expected, actual);