Skip to content

Commit

Permalink
[tests] Fix CRLF issues in SM.Syndication
Browse files Browse the repository at this point in the history
Fixes: dotnet#52135

When running `System.ServiceModel.Syndication` tests on windows and
targeting `Browser`, the line ending differs between host and target
systems. Use helper `LineEndingsHelper.Normalize` method to update
expected strings.

The `Browser` Environment.NewLine is `\n`, while windows use `\r\n`.
https://github.com/dotnet/runtime/blob/5bd0edfe860e41bdfd690d3743e730594307292e/src/libraries/System.Private.CoreLib/src/System/Environment.UnixOrBrowser.cs#L51

Also set `BrowserHost` property for the build as well. It is also used
in `src/libraries/tests.proj`.
  • Loading branch information
radekdoulik committed May 13, 2021
1 parent 8b6f404 commit 0305ee9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion eng/pipelines/runtime-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ jobs:
jobParameters:
testGroup: innerloop
nameSuffix: Browser_wasm_Windows
buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true
buildArgs: -subset mono+libs+host+packs+libs.tests -c $(_BuildConfig) /p:ArchiveTests=true /p:BrowserHost=windows
timeoutInMinutes: 120
condition: >-
or(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ public static void AssertEqualWriteOutput(string expected, Action<XmlWriter> wri

public static void AssertEqualLongString(string expected, string actual)
{
if (!LineEndingsHelper.IsNewLineConsistent)
expected = LineEndingsHelper.Normalize(expected);

if (actual != expected)
{
string message = "-- Expected -" + Environment.NewLine + expected + Environment.NewLine + "-- Actual -" + Environment.NewLine + actual + Environment.NewLine;
Expand Down

0 comments on commit 0305ee9

Please sign in to comment.