-
Notifications
You must be signed in to change notification settings - Fork 748
Is.SupersetOf and Is.SubsetOf no longer work with IImmmutableDictionary<TKey,TValue> in NUnit 3.13.3 #4095
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
Comments
Oops - I got my wires crossed and used |
Thanks @danlyons-softek for the clear repro. |
Can confirm this is present on v4 as well. Thanks for spotting this. It looks like the attempt to fast-path building a sortable ArrayList if the nunit/src/NUnitFramework/framework/Constraints/CollectionTally.cs Lines 132 to 133 in 2e39a96
The conversion itself is done within the ImmutableDictionary, when This is then causing the slowpath comparer to fail when trying to do a deep-equality check here:
actual argument to an ArrayList here:
Leaving the constraint as trying to compare two fundamentally different types. The simplest fix here is probably to remove this fastpath check from within NUnit so that we always add the items to the ArrayList individually if (items is ICollection ic)
return new ArrayList(ic); |
Closed by #4097 |
Thanks! I should be able to get the v4 merge PR up within the next few days |
@stevenaw This bug has been in v3.13.3 for over a year, can we release a v3.13.4 |
Agreed, I'd been thinking about this just last week that we should get 3.14 out. |
The following test passes in 3.13.2, but it fails in 3.13.3:
Output:
I notice that if both calls are instead
ToDictionary
, the test passes, but if either one isToImmmutableDictionary
, it fails.I also noticed that using any of
ToImmutableList
,ToImmutableArray
, orToImmutableHashSet
works (even when paired with non-immutable counterparts), so this seems limited to immutable dictionaries in particular.project files attached:
testimmutabledictionary.zip
The text was updated successfully, but these errors were encountered: