From 23b987ad78601970b003290058d34c03b1df05f7 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Tue, 27 Jun 2023 13:48:26 -0700 Subject: [PATCH 1/3] Use xunit.assert fork in dotnet/runtime Makes xunit.assert AOT-compatible for libraries testing. --- eng/Versions.props | 1 + .../Common/tests/TestUtilities/TestUtilities.csproj | 4 +++- src/libraries/System.Runtime/tests/System/ArrayTests.cs | 3 +++ .../NewtonsoftTests/ImmutableCollectionsTests.cs | 9 ++++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index eacb1421d65536..6a7511cab94ccc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -88,6 +88,7 @@ 8.0.0-beta.23411.1 8.0.0-beta.23411.1 8.0.0-beta.23411.1 + 8.0.0-beta.23411.1 8.0.0-beta.23411.1 2.5.1-beta.23411.1 8.0.0-beta.23411.1 diff --git a/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj b/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj index cbb1f4ed69be90..2273e3bd088a28 100644 --- a/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj +++ b/src/libraries/Common/tests/TestUtilities/TestUtilities.csproj @@ -107,13 +107,15 @@ - + + + diff --git a/src/libraries/System.Runtime/tests/System/ArrayTests.cs b/src/libraries/System.Runtime/tests/System/ArrayTests.cs index 7ef45b6401ad0e..1d1272f8e9e054 100644 --- a/src/libraries/System.Runtime/tests/System/ArrayTests.cs +++ b/src/libraries/System.Runtime/tests/System/ArrayTests.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; +using System.Threading.Tasks; using Microsoft.DotNet.XUnitExtensions; using Xunit; using Xunit.Abstractions; @@ -4299,6 +4300,8 @@ public class Bar : IEquatable public string Value { get; set; } public bool Equals(Bar other) => string.Equals(Value, other.Value); + public override bool Equals(object other) => Equals(other as Bar); + public override int GetHashCode() => Value.GetHashCode(); } public class Foo diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/NewtonsoftTests/ImmutableCollectionsTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/NewtonsoftTests/ImmutableCollectionsTests.cs index 26226b2bc1e6bf..946b4c14352088 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/NewtonsoftTests/ImmutableCollectionsTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/NewtonsoftTests/ImmutableCollectionsTests.cs @@ -250,7 +250,8 @@ public void SerializeHashSet() string json = JsonSerializer.Serialize(data, s_indentedOption); - ImmutableHashSet a = JsonSerializer.Deserialize>(json); + // Use ISet to disambiguate between ISet and IReadOnlySet overloads below + ISet a = JsonSerializer.Deserialize>(json); Assert.Equal(3, a.Count); Assert.Contains("One", a); Assert.Contains("II", a); @@ -266,7 +267,8 @@ public void DeserializeHashSet() ""3"" ]"; - ImmutableHashSet data = JsonSerializer.Deserialize>(json); + // Use ISet to disambiguate between ISet and IReadOnlySet overloads below + ISet data = JsonSerializer.Deserialize>(json); Assert.Equal(3, data.Count); Assert.Contains("3", data); @@ -316,7 +318,8 @@ public void DeserializeSortedSet() ""3"" ]"; - ImmutableSortedSet data = JsonSerializer.Deserialize>(json); + // Use ISet to disambiguate between ISet and IReadOnlySet overloads below + ISet data = JsonSerializer.Deserialize>(json); Assert.Equal(3, data.Count); Assert.Contains("3", data); From f0eb74446038a086f8db39803b58aa03223a93bd Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Thu, 24 Aug 2023 13:58:04 -0700 Subject: [PATCH 2/3] Add XUnitAssert to version details --- eng/Version.Details.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ab67345d0fe5b3..449f43467232d2 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -129,6 +129,10 @@ https://github.com/dotnet/arcade 9b2af35a6702526dc8a7c5fcadcc44efd0dca170 + + https://github.com/dotnet/arcade + 9b2af35a6702526dc8a7c5fcadcc44efd0dca170 + https://github.com/dotnet/arcade 9b2af35a6702526dc8a7c5fcadcc44efd0dca170 From 52377abb1aaa7a0fda146ce65c7f51d02e2ccb83 Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 25 Aug 2023 09:25:06 -0700 Subject: [PATCH 3/3] Try including all of Xunit.Assert in the rd.xml --- src/libraries/System.Linq.Expressions/tests/default.rd.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libraries/System.Linq.Expressions/tests/default.rd.xml b/src/libraries/System.Linq.Expressions/tests/default.rd.xml index e3505c08f84580..8f9762a7fb7344 100644 --- a/src/libraries/System.Linq.Expressions/tests/default.rd.xml +++ b/src/libraries/System.Linq.Expressions/tests/default.rd.xml @@ -4,6 +4,10 @@ + + + +