Skip to content

Commit

Permalink
Add Should-* aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd committed Apr 7, 2024
1 parent 0230d8c commit 3d1d896
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 3 deletions.
55 changes: 53 additions & 2 deletions src/Module.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,33 @@ $script:SafeCommands['Get-MockDynamicParameter'] = $ExecutionContext.SessionStat
$script:SafeCommands['Write-PesterDebugMessage'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Write-PesterDebugMessage', 'function')
$script:SafeCommands['Set-DynamicParameterVariable'] = $ExecutionContext.SessionState.InvokeCommand.GetCommand('Set-DynamicParameterVariable', 'function')

& $SafeCommands['Set-Alias'] 'Add-AssertionOperator' 'Add-ShouldOperator'
& $SafeCommands['Set-Alias'] 'Get-AssertionOperator' 'Get-ShouldOperator'
& $SafeCommands['Set-Alias'] 'Add-AssertionOperator' 'Add-ShouldOperator'
& $SafeCommands['Set-Alias'] 'Get-AssertionOperator' 'Get-ShouldOperator'

& $SafeCommands['Set-Alias'] 'Should-BeFalse' 'Assert-False'
& $SafeCommands['Set-Alias'] 'Should-BeTrue' 'Assert-True'
& $SafeCommands['Set-Alias'] 'Should-All' 'Assert-All'
& $SafeCommands['Set-Alias'] 'Should-Any' 'Assert-Any'
& $SafeCommands['Set-Alias'] 'Should-Contain' 'Assert-Contain'
& $SafeCommands['Set-Alias'] 'Should-NotContain' 'Assert-NotContain'
& $SafeCommands['Set-Alias'] 'Should-BeEquivalent' 'Assert-Equivalent'
& $SafeCommands['Set-Alias'] 'Should-Throw' 'Assert-Throw'
& $SafeCommands['Set-Alias'] 'Should-BeEqual' 'Assert-Equal'
& $SafeCommands['Set-Alias'] 'Should-BeGreaterThan' 'Assert-GreaterThan'
& $SafeCommands['Set-Alias'] 'Should-BeGreaterThanOrEqual' 'Assert-GreaterThanOrEqual'
& $SafeCommands['Set-Alias'] 'Should-BeLessThan' 'Assert-LessThan'
& $SafeCommands['Set-Alias'] 'Shoulde-BeLessThanOrEqual' 'Assert-LessThanOrEqual'
& $SafeCommands['Set-Alias'] 'Should-NotBeEqual' 'Assert-NotEqual'
& $SafeCommands['Set-Alias'] 'Should-NotBeNull' 'Assert-NotNull'
& $SafeCommands['Set-Alias'] 'Should-NotBeSame' 'Assert-NotSame'
& $SafeCommands['Set-Alias'] 'Should-NotBeType' 'Assert-NotType'
& $SafeCommands['Set-Alias'] 'Should-BeNull' 'Assert-Null'
& $SafeCommands['Set-Alias'] 'Should-BeSame' 'Assert-Same'
& $SafeCommands['Set-Alias'] 'Should-BeType' 'Assert-Type'
& $SafeCommands['Set-Alias'] 'Should-BeLike' 'Assert-Like'
& $SafeCommands['Set-Alias'] 'Should-NotBeLike' 'Assert-NotLike'



& $SafeCommands['Update-TypeData'] -TypeName PesterConfiguration -TypeConverter 'PesterConfigurationDeserializer' -SerializationDepth 5 -Force
& $SafeCommands['Update-TypeData'] -TypeName 'Deserialized.PesterConfiguration' -TargetTypeForDeserialization PesterConfiguration -Force
Expand Down Expand Up @@ -82,4 +107,30 @@ $script:SafeCommands['Set-DynamicParameterVariable'] = $ExecutionContext.Session
) -Alias @(
'Add-AssertionOperator'
'Get-AssertionOperator'

# assert
'Should-BeFalse'
'Should-BeTrue'
'Should-All'
'Should-Any'
'Should-Contain'
'Should-NotContain'
'Should-BeEquivalent'
'Should-Throw'
'Should-BeEqual'
'Should-BeGreaterThan'
'Should-BeGreaterThanOrEqual'
'Should-BeLessThan'
'Shoulde-BeLessThanOrEqual'
'Should-NotBeEqual'
'Should-NotBeNull'
'Should-NotBeSame'
'Should-NotBeType'
'Should-BeNull'
'Should-BeSame'
'Should-BeType'
'Should-BeLike'
'Should-NotBeLike'
'Should-StringBeEqual'
'Should-StringNotBeEqual'
)
27 changes: 26 additions & 1 deletion src/Pester.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
'Assert-StringEqual'
'Assert-StringNotEqual'


# legacy
'Assert-VerifiableMock'
'Assert-MockCalled'
Expand All @@ -112,6 +111,32 @@
AliasesToExport = @(
'Add-AssertionOperator'
'Get-AssertionOperator'

# assert
'Should-BeFalse'
'Should-BeTrue'
'Should-All'
'Should-Any'
'Should-Contain'
'Should-NotContain'
'Should-BeEquivalent'
'Should-Throw'
'Should-BeEqual'
'Should-BeGreaterThan'
'Should-BeGreaterThanOrEqual'
'Should-BeLessThan'
'Shoulde-BeLessThanOrEqual'
'Should-NotBeEqual'
'Should-NotBeNull'
'Should-NotBeSame'
'Should-NotBeType'
'Should-BeNull'
'Should-BeSame'
'Should-BeType'
'Should-BeLike'
'Should-NotBeLike'
'Should-StringBeEqual'
'Should-StringNotBeEqual'
)


Expand Down

0 comments on commit 3d1d896

Please sign in to comment.