Moved StrictOrder, PowerShell 7.0.0-preview.2 DBNull support and StrictEquality#45
Open
ili101 wants to merge 4 commits intonohwnd:masterfrom
Open
Moved StrictOrder, PowerShell 7.0.0-preview.2 DBNull support and StrictEquality#45ili101 wants to merge 4 commits intonohwnd:masterfrom
ili101 wants to merge 4 commits intonohwnd:masterfrom
Conversation
…: in mode "Equivalency" it will pass and fail for "Equality" in all PS versions. Also Deserialize DBNull support added as Deserialize DataTable and DataRow are already supported and it was missing.
Contributor
Author
|
Added commit 6166abf as travis-ci was failing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi
This pull is to replace in part the outdated pull #34.
There are 3 things covered here:
Commit c770340 - Moved StrictOrder to Get-EquivalencyOption from Assert-Equivalent so it will be in the same place with all the other configuration options.
Commit 6aea1e0 - Deserialize DBNull support added as Deserialize DataTable and DataRow are already supported in the existing version and it is missing to complete the set to make this usable.
Commit 959c9ca - Added a new -Comparator Option 'StrictEquality'
Use this code to illustrate the 3 modes ('Equivalency', 'Equality', 'StrictEquality')
PowerShell 7.0.0-preview.2
PowerShell 5.1
Equivalency - Return true in all the tested situations, using your existing equivalency code.
StrictEquality - Return false in all the tested situations, it verifies that the Type is the same in addition to the value test.
Equality - Exactly the same as doing
$Expected -eq $Actual(Can return different results depending on the PS version and the side of the variable ('False' -eq $falsevs$false -eq 'False')).Since PowerShell 7.0.0-preview.2 DBNull -eq $null.
So in Equality mode the result will depend on the PowerShell version as
[DBNull]::Value -eq $nullwill depend on the PowerShell version.In Equivalency mode this inconsistency is fixed to reflect the spirit of PS7 and it will be true in all PS versions.
In StrictEquality it will return false as in StrictEquality mode the Types need to be identical to pass.