From 918b0f509e364cc26ab88f975fd70d33e649d7a9 Mon Sep 17 00:00:00 2001 From: Katelyn Gadd Date: Wed, 24 Apr 2024 10:51:02 -0700 Subject: [PATCH] Test fixes --- src/libraries/System.Console/tests/ReadAndWrite.cs | 4 +++- .../tests/System.IO.Tests/StreamReader/StreamReader.cs | 1 + .../tests/System.IO.Tests/StreamWriter/StreamWriter.cs | 1 + .../tests/System.IO.Tests/TextWriter/TextWriterTests.cs | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Console/tests/ReadAndWrite.cs b/src/libraries/System.Console/tests/ReadAndWrite.cs index d60fd6aa34cc04..913d85835dbb18 100644 --- a/src/libraries/System.Console/tests/ReadAndWrite.cs +++ b/src/libraries/System.Console/tests/ReadAndWrite.cs @@ -158,7 +158,9 @@ public static async Task OutWriteAndWriteLineOverloads() Console.SetOut(sw); TextWriter writer = Console.Out; Assert.NotNull(writer); - Assert.NotEqual(writer, sw); // the writer we provide gets wrapped + // Browser bypasses SyncTextWriter for faster startup + if (!OperatingSystem.IsBrowser()) + Assert.NotEqual(writer, sw); // the writer we provide gets wrapped // We just want to ensure none of these throw exceptions, we don't actually validate // what was written. diff --git a/src/libraries/System.Runtime/tests/System.IO.Tests/StreamReader/StreamReader.cs b/src/libraries/System.Runtime/tests/System.IO.Tests/StreamReader/StreamReader.cs index bd455448efccaf..bf50637d5f7acb 100644 --- a/src/libraries/System.Runtime/tests/System.IO.Tests/StreamReader/StreamReader.cs +++ b/src/libraries/System.Runtime/tests/System.IO.Tests/StreamReader/StreamReader.cs @@ -30,6 +30,7 @@ public void ObjectClosedReadLineBaseStream() } [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Browser bypasses SyncTextWriter for faster startup")] public void Synchronized_NewObject() { using (Stream str = GetLargeStream()) diff --git a/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.cs b/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.cs index 69edb13a8a1fce..eb4718aaf0f2e1 100644 --- a/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.cs +++ b/src/libraries/System.Runtime/tests/System.IO.Tests/StreamWriter/StreamWriter.cs @@ -8,6 +8,7 @@ namespace System.IO.Tests public partial class WriteTests { [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Browser bypasses SyncTextWriter for faster startup")] public void Synchronized_NewObject() { using (Stream str = CreateStream()) diff --git a/src/libraries/System.Runtime/tests/System.IO.Tests/TextWriter/TextWriterTests.cs b/src/libraries/System.Runtime/tests/System.IO.Tests/TextWriter/TextWriterTests.cs index 2299dc86f567db..d021010e54d9dc 100644 --- a/src/libraries/System.Runtime/tests/System.IO.Tests/TextWriter/TextWriterTests.cs +++ b/src/libraries/System.Runtime/tests/System.IO.Tests/TextWriter/TextWriterTests.cs @@ -691,6 +691,7 @@ public void DisposeAsync_ExceptionReturnedInTask() } [Fact] + [SkipOnPlatform(TestPlatforms.Browser, "Browser bypasses SyncTextWriter for faster startup")] public async Task FlushAsync_Precanceled() { Assert.Equal(TaskStatus.RanToCompletion, TextWriter.Null.FlushAsync(new CancellationToken(true)).Status);