Add array and hastable assertions#804
Conversation
|
Hi Stuart,
Thanks for the PR. I like the idea, but I will mark it for 4.1 release so I might take a while till it's reviewed properly and merged. I only had a very quick look and I think we need to brainstorm about the naming a bit till we commit to using Match in the assertion name. This term is normally associated with Regular expressions.
It's also a bit limiting that you can provide only a single param to the assertion, but that is how it works for the moment.
|
|
Please also review why it failed to build on the build server. |
2bd1847 to
018431a
Compare
|
Thanks @nohwnd - I look forward to discussing this more with you when the 4.0 release is out :-) |
018431a to
baad719
Compare
|
@nohwnd - I've just updated the PR and it looks like the build is passing now: https://build.powershell.org/viewLog.html?buildId=10884&tab=buildResultsDiv&buildTypeId=Pester_TestPesterOnPowerShellV2 |
|
#121 - is it related? |
|
From scanning the thread on that issue, it looks like the OP wants to test for the existence of an element in an array. This PR is intended to allow comparison of the full array or hashtable, so I think that they are slightly different cases. |
|
Thx, I just found it in a middle of the night so wasn't sure. |
|
In v4, |
|
Thanks @dlwyatt , I didn't know this. This feature, comparing of Might be something for #876 |
|
@DarkLite1, I assume that it was described in the updated version of about_Should. Can you verify? Help for Should itself is very limited intentionally. |
|
The label 'Documentation' added - to remember to add information about |
|
@stuartleeks Stuart thanks for your contribution, but I won't merge this. I plan to move Assert into Pester and use the functionality developed there to give Pester collection, hashtable, and dictionary comparing assertions. Hope this will give us more options such as ordered, non-ordered, each and any. |
Based on a tweet from @it-praktyk (https://twitter.com/ITpraktyk/status/889585074760552453), I'm submitting a PR with the array and hashtable assertions from my pester extensions.
I used them in my posh-HumpCompletion tests here: https://github.com/stuartleeks/posh-HumpCompletion/blob/master/posh-HumpCompletion.tests.ps1#L64
Let me know what you think, and whether there are any changes you'd recommend :-)