Skip to content

Commit

Permalink
Fix alias Should-BeBlockString
Browse files Browse the repository at this point in the history
  • Loading branch information
johlju committed Aug 20, 2024
1 parent 9e09b25 commit 1f55c00
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added

- Asserts:
- `Assert-BlockString`
- `Assert-BlockString` (alias `Should-BeBlockString`)
4 changes: 2 additions & 2 deletions source/Public/Assert-BlockString.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@
https://github.com/pester/Pester/commit/c8bc9679bed19c8fbc4229caa01dd083f2d03d4f#diff-b7592dd925696de2521c9b12b966d65519d502045462f002c343caa7c0986936
and
https://github.com/pester/Pester/commit/c8bc9679bed19c8fbc4229caa01dd083f2d03d4f#diff-460f64eafc16facefbed201eb00fb151c75eadf7cc58a504a01527015fb1c7cdR17
#>
function Assert-BlockString # Should-BeBlockString
function Assert-BlockString
{
[Alias('Should-BeBlockString')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseProcessBlockForPipelineCommand', '')]
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('AvoidThrowOutsideOfTry', '')]
param
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/Public/Assert-BlockString.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,12 @@ Describe 'Assert-BlockString' {
}
{ & $scriptBlock } | Should -Not -Throw
}

It 'Should be able to be called using its alias' {
$Expected = 'Test string'
$scriptBlock = {
'Test string' | Should-BeBlockString -Expected $Expected
}
{ & $scriptBlock } | Should -Not -Throw
}
}

0 comments on commit 1f55c00

Please sign in to comment.