Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use xunit.assert fork in dotnet/runtime #91091

Merged
merged 4 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Use xunit.assert fork in dotnet/runtime
Makes xunit.assert AOT-compatible for libraries testing.
  • Loading branch information
agocke committed Aug 24, 2023
commit 23b987ad78601970b003290058d34c03b1df05f7
1 change: 1 addition & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
<MicrosoftDotNetCodeAnalysisVersion>8.0.0-beta.23411.1</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftDotNetGenAPIVersion>8.0.0-beta.23411.1</MicrosoftDotNetGenAPIVersion>
<MicrosoftDotNetGenFacadesVersion>8.0.0-beta.23411.1</MicrosoftDotNetGenFacadesVersion>
<MicrosoftDotNetXUnitAssertVersion>8.0.0-beta.23411.1</MicrosoftDotNetXUnitAssertVersion>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably also want a Version.Details.xml entry to keep the version up-to-date.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! Nice catch, thanks

<MicrosoftDotNetXUnitExtensionsVersion>8.0.0-beta.23411.1</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.23411.1</MicrosoftDotNetXUnitConsoleRunnerVersion>
<MicrosoftDotNetBuildTasksArchivesVersion>8.0.0-beta.23411.1</MicrosoftDotNetBuildTasksArchivesVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,15 @@
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.XUnitExtensions" Version="$(MicrosoftDotNetXUnitExtensionsVersion)" />
<PackageReference Include="xunit.core" Version="$(XUnitVersion)" ExcludeAssets="build" />
<PackageReference Include="xunit.assert" Version="$(XUnitVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
<!-- Upgrade the NetStandard.Library transitive xunit dependency to avoid 1.x NS dependencies. -->
<PackageReference Include="NETStandard.Library" Version="$(NetStandardLibraryVersion)" />
<!-- Use the arcade fork of xunit.assert for AOT-compat -->
<PackageReference Include="Microsoft.DotNet.XUnitAssert" Version="$(MicrosoftDotNetXUnitAssertVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="System.Memory" Version="$(SystemMemoryVersion)" />
<PackageReference Include="xunit.assert" Version="$(XUnitVersion)" />
</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions src/libraries/System.Runtime/tests/System/ArrayTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -4299,6 +4300,8 @@ public class Bar : IEquatable<Bar>
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,8 @@ public void SerializeHashSet()

string json = JsonSerializer.Serialize(data, s_indentedOption);

ImmutableHashSet<string> a = JsonSerializer.Deserialize<ImmutableHashSet<string>>(json);
// Use ISet to disambiguate between ISet and IReadOnlySet overloads below
ISet<string> a = JsonSerializer.Deserialize<ImmutableHashSet<string>>(json);
Assert.Equal(3, a.Count);
Assert.Contains("One", a);
Assert.Contains("II", a);
Expand All @@ -266,7 +267,8 @@ public void DeserializeHashSet()
""3""
]";

ImmutableHashSet<string> data = JsonSerializer.Deserialize<ImmutableHashSet<string>>(json);
// Use ISet to disambiguate between ISet and IReadOnlySet overloads below
ISet<string> data = JsonSerializer.Deserialize<ImmutableHashSet<string>>(json);

Assert.Equal(3, data.Count);
Assert.Contains("3", data);
Expand Down Expand Up @@ -316,7 +318,8 @@ public void DeserializeSortedSet()
""3""
]";

ImmutableSortedSet<string> data = JsonSerializer.Deserialize<ImmutableSortedSet<string>>(json);
// Use ISet to disambiguate between ISet and IReadOnlySet overloads below
ISet<string> data = JsonSerializer.Deserialize<ImmutableSortedSet<string>>(json);

Assert.Equal(3, data.Count);
Assert.Contains("3", data);
Expand Down