Skip to content

Commit 0e54866

Browse files
Fix Windows line endings in FindNodeTests
1 parent 24f277c commit 0e54866

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindNodeTests.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,19 @@
11
// Copyright (c) .NET Foundation. All rights reserved.
22
// Licensed under the MIT license. See License.txt in the project root for license information.
33

4+
using System.Runtime.InteropServices;
45
using Microsoft.AspNetCore.Razor.Language;
6+
using Microsoft.AspNetCore.Razor.Test.Common;
57
using Microsoft.CodeAnalysis.Razor.Workspaces.Extensions;
68
using Microsoft.CodeAnalysis.Text;
79
using Xunit;
810
using Xunit.Abstractions;
911

1012
namespace Microsoft.AspNetCore.Razor.LanguageServer.Test;
1113

12-
public class FindNodeTests
14+
public class FindNodeTests(ITestOutputHelper testOutput) : ToolingTestBase(testOutput)
1315
{
14-
private readonly ITestOutputHelper _outputHelper;
15-
16-
public FindNodeTests(ITestOutputHelper outputHelper)
17-
{
18-
_outputHelper = outputHelper;
19-
}
20-
21-
const string FetchDataContents = """
16+
private const string FetchDataContents = """
2217
@page "/fetchdata"
2318
@using BlazorApp.Data
2419
@inject WeatherForecastService ForecastService
@@ -68,6 +63,10 @@ protected override async Task OnInitializedAsync()
6863
}
6964
""";
7065

66+
private static readonly string s_fetchDataContents = RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
67+
? FetchDataContents
68+
: FetchDataContents.Replace("\n", "\r\n");
69+
7170
[Theory]
7271
[InlineData(0, 1, SyntaxKind.CSharpTransition, false)]
7372
[InlineData(0, 1, SyntaxKind.CSharpTransition, true)]
@@ -246,7 +245,7 @@ protected override async Task OnInitializedAsync()
246245
[InlineData(944, 1162, SyntaxKind.MarkupTextLiteral, true)]
247246
[InlineData(0, 1162, SyntaxKind.MarkupBlock, false)]
248247
internal void Test_On_FetchData(int start, int end, SyntaxKind kind, bool includeWhitespace)
249-
=> Verify(FetchDataContents, start, end, kind, includeWhitespace, innermostForTie: true);
248+
=> Verify(s_fetchDataContents, start, end, kind, includeWhitespace, innermostForTie: true);
250249

251250
private static void Verify(string input, int start, int end, SyntaxKind kind, bool includeWhitespace, bool innermostForTie)
252251
{

0 commit comments

Comments
 (0)