Skip to content

Commit

Permalink
Fix escaping outside of string
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Aug 23, 2024
1 parent b9002d1 commit 0204903
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/functions/assertions/PesterThrow.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@

$filterOnMessage = -not [string]::IsNullOrWhitespace($ExpectedMessage)
if ($filterOnMessage) {
$filters += "message like $(Format-Nicely ([System.Management.Automation.WildcardPattern]::Unescape($ExpectedMessage)))"
$unescapedExpectedMessage = [System.Management.Automation.WildcardPattern]::Unescape($ExpectedMessage)
$filters += "message like $(Format-Nicely $unescapedExpectedMessage)"
if ($actualExceptionWasThrown -and (-not (Get-DoValuesMatch $actualExceptionMessage $ExpectedMessage))) {
$buts += "the message was $(Format-Nicely $actualExceptionMessage)"
}
Expand Down

0 comments on commit 0204903

Please sign in to comment.