Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Improve Get-ShouldOperator #1163
Comments
|
still available? if so, i'll be happy to check this one |
|
@Stephanevg yup. Looks like you are the first one. |
|
I will be happy too |
|
@nohwnd I think you meant:
right? Cause I have this when I use
|
|
I am sorry to ask, but either I didn't fully understand what problem we need to fix here, or I am missing something. I originally thought that this issue would be as easy as editing the 'comment Based Help' of the BE operator, but It seems there is a bit more to it. Perhaps you can give me a hint of where I should look? ;) Let me explain my rationale: for example, any other 'ShouldOperator' return the same output. Be exactly[DBG]: Get-ShouldOperator -Name BeExactly
NAME
Should-BeExactly
SYNOPSIS
Compares one object with another for equality and throws if the
two objects are not the same. This comparison is case sensitive.
-------------------------- EXAMPLE 1 --------------------------
PS C:\>$actual = "Actual value"
PS C:\>$actual | Should -Be "Actual value"
This test will pass. The two strings are identical.
-------------------------- EXAMPLE 2 --------------------------
PS C:\>$actual = "Actual value"
PS C:\>$actual | Should -Be "actual value"
This test will fail, as the two strings do not match case sensitivity.
This actually highlights that the issue is not an isoolated issue, as in opposition of what I thought. Process understanding:It seems to me, that I missing a (obvious) part The assertion operator nd it Alias is declared in Add-AssertionOperator -Name Be `
-InternalName Should-Be `
-Test ${function:Should-Be} `
-Alias 'EQ' `
-SupportsArrayInputand later is called via the Get-ShouldOperator function located in $operator = $AssertionOperators.Values | Where-Object { $Name -eq $_.Name -or $_.Alias -contains $Name }
$help = Get-Help $operator.InternalName -Examples -ErrorAction SilentlyContinueUnfortunatley, it is not possible to add simply a '.ALIASES' part to a comment based help section. It seems like there is a limited list, that we can used for Internal comment based help keywords See here for more details. With all that said, I can think of two options, which both I don't like:
Or perhaps I missed something? in that case, please hint me in the right direction :) Cheers |
|
|
@Stephanevg Still interested in implementing this? |
|
Hi @nohwnd I'll look into it later this week if ok. If this is urgent, somebody else could potentially do it then. |
|
Not urgent :) |
|
Hey @nohwnd sorry It took me ages to come back to this one. I just looked at it again. Launching a short test, I see this: I asume that this is now fixed, right? |
|
I don’t think it is. The issue is about the detail of the operator, not the overview (in your screenshot). |
|
Ok, I have got something working here, but I am not really a big fan of the output, and that is something I think we ned to discuss. I did a PR (#1272) so we can maybe discuss directly in the code there. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.


Get-ShouldOperatorshows:on the top, and does not show aliases. It would be nice to replace the name section with this:
(the two last aliases don't actually exist on Be)
Related to #878