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

(GH-144) Enable order-insensitive comparisons for DSC #151

Merged
merged 2 commits into from
Jun 18, 2021
Merged

(GH-144) Enable order-insensitive comparisons for DSC #151

merged 2 commits into from
Jun 18, 2021

Conversation

michaeltlombardi
Copy link
Contributor

Prior to this commit value comparisons in the DSC Base Provider only partially worked for arrays and hashes; in PowerShell, the order of a hash or array does not matter for comparison but in Ruby hashes and arrays are order-sensitive.

The same? method was meant to get around this but only worked for non-enumerable values and values which were simple arrays.

This commit adds a new recursively_sort method to obviate this issue and calls it in same?

Prior to this commit value comparisons in the DSC Base Provider
only partially worked for arrays and hashes; in PowerShell, the
order of a hash or array does not matter for comparison but in
Ruby hashes and arrays are order-sensitive.

The same? method was meant to get around this but only worked
for non-enumerable values and values which were simple arrays.

This commit adds a new recursively_sort method to obviate this
issue and calls it in same?
@michaeltlombardi
Copy link
Contributor Author

Test failures on Travis are due to a break in Microsoft's apt repos; see dotnet/core#6381

@david22swan david22swan merged commit cf21330 into puppetlabs:main Jun 18, 2021
@michaeltlombardi michaeltlombardi deleted the gh-144/main/deep-sort-in-same branch June 22, 2021 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

same? should be able to order insensitively compare deeply nested arrays and hashes
2 participants