mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
added test to determine if output is correct
This commit is contained in:
@@ -29,8 +29,27 @@ Describe "Test-Format-List" {
|
||||
It "Should be able to display a list of props when separated by a comma" {
|
||||
$testCommand = Get-Process
|
||||
|
||||
{ $testCommand | Format-List -Property Name,BasePriority }| Should Not Throw
|
||||
{ $testCommand | Format-List -Property Name,BasePriority } | Should Not Throw
|
||||
|
||||
{ $testCommand | fl -Property Name,BasePriority } | Should Not Throw
|
||||
}
|
||||
|
||||
It "Should not show only the requested props" {
|
||||
$testCommand = Get-Process
|
||||
|
||||
( $testCommand | Format-List | Out-String).Contains("CPU") | Should Be $true
|
||||
( $testCommand | Format-List -Property Name | Out-String).Contains("CPU") | Should Be $false
|
||||
|
||||
( $testCommand | fl | Out-String).Contains("CPU") | Should Be $true
|
||||
( $testCommand | fl -Property Name | Out-String).Contains("CPU") | Should Be $false
|
||||
}
|
||||
|
||||
It "Should be able to take input without piping objects to it" {
|
||||
$input = (Get-Process)[0]
|
||||
|
||||
{ Format-List -InputObject $input } | Should Not Throw
|
||||
|
||||
{ fl -InputObject $input } | Should Not Throw
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user