Open johlju opened 3 weeks ago
Maybe just
[System.Management.Automation.WildcardPattern]::Unescape('string`[`]')
on the expected message?
+1 for this, incl. backport to 5.6.*. Would you like to provide a PR?
I'd also vote for updating the text in Should-Throw
to match the "with message like ..." style of Should -Throw
as it implies that it's a -like
pattern.
I can try doing a PR. It should be fairly small for me to be able to get it done.
@fflaten how is backport done. Two PR's targeting main
and ...?
respectively?
Thanks 🙏
Yes, main for v6 and rel/5.6.x for backport.
There is a bot comment for this, but probably easier to cherry pick manually as you only need the Should -Throw change for v5 PR
Checklist
What is the issue?
When having wildcard characters in the
ExceptionMessage
(Should-Throw
) orExpectedMessage
(Should -Throw
) they are not removed from the expected message in the console making it look like the string is expected to actually have backticks. This is a minor issue, but maybe it possible to make it look better in the futuee.This is related to issue #1793 which might or might not resolve this.
Expected Behavior
Remove backticks from the expected message that is output on the console.
Steps To Reproduce
outputs:
Here it outputs
Expected an exception, with message 'string`[`]' to be thrown
where it would be better if it could have been output asExpected an exception, with message 'string[]' to be thrown
.Describe your environment
Possible Solution?
Maybe just
[System.Management.Automation.WildcardPattern]::Unescape('string`[`]')
on the expected message?