From f24dfb02dc3b77290e31d8c1b2a9758c9c47b126 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Tue, 4 Aug 2015 16:07:14 -0700 Subject: [PATCH 01/12] added Format-List test --- src/pester-tests/Test-Format-List.Tests.ps1 | 36 +++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/pester-tests/Test-Format-List.Tests.ps1 diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 new file mode 100644 index 000000000..c1dc0cac3 --- /dev/null +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -0,0 +1,36 @@ +Describe "Test-Format-List" { + It "Should call format list without error" { + { Get-Process | Format-List } | Should Not Throw + + { Get-Process | fl } | Should Not Throw + } + + It "Should be able to call format list on piped in variable objects" { + $a = Get-Process + + { $a | Format-List } | Should Not Throw + + { $a | fl } | Should Not Throw + } + + It "Should be able to call a property of the piped input" { + #Tested on two input commands to veryify functionality. + $testCommand1 = Get-Process + $testCommand2 = Get-Date + + { $testCommand1 | Format-List -Property Name } | Should Not Throw + { $testCommand2 | Format-List -Property DisplayName } | Should Not Throw + + + { $testCommand1 | fl -Property Name } | Should Not Throw + { $testCommand2 | fl -Property DisplayName } | Should Not Throw + } + + 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 | fl -Property Name,BasePriority } | Should Not Throw + } +} From 052165d15a0928d33276c016523f583509499b90 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Wed, 5 Aug 2015 16:01:10 -0700 Subject: [PATCH 02/12] added test to determine if output is correct --- src/pester-tests/Test-Format-List.Tests.ps1 | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index c1dc0cac3..918f2f318 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -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 + } + } From b0d7a2153e816a6415aa6c1d5138de5b60a46e14 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Thu, 6 Aug 2015 11:31:30 -0700 Subject: [PATCH 03/12] changed it statement to accurately reflect test --- src/pester-tests/Test-Format-List.Tests.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 918f2f318..0895f6b99 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -34,14 +34,12 @@ Describe "Test-Format-List" { { $testCommand | fl -Property Name,BasePriority } | Should Not Throw } - It "Should not show only the requested props" { + It "Should not show anything other than 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" { From ba17c42d3852863b03764f1f0572f33a6042f94e Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Thu, 6 Aug 2015 13:11:05 -0700 Subject: [PATCH 04/12] added comments explaining why the test has to be scripted this way --- src/pester-tests/Test-Format-List.Tests.ps1 | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 0895f6b99..0d62afa3f 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -36,7 +36,13 @@ Describe "Test-Format-List" { It "Should not show anything other than the requested props" { $testCommand = Get-Process + <# the structure of the output of format-list, although iterable, is not a proper collection of objects we can test + gps | fl | ForEach-Object{$_.ToString()} confirms that each item is a format object. + + (Get-Process | Format-List | Out-String).split("\n") | ForEach-Object { $_} will list objects, but not allow interaction with them. + + #> ( $testCommand | Format-List | Out-String).Contains("CPU") | Should Be $true ( $testCommand | Format-List -Property Name | Out-String).Contains("CPU") | Should Be $false From 49d5bf11210294989912654c11b67a372e32f22c Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Thu, 6 Aug 2015 16:40:10 -0700 Subject: [PATCH 05/12] added custom powershell object to properly mock the test function --- src/pester-tests/Test-Format-List.Tests.ps1 | 73 ++++++++++++++------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 0d62afa3f..cd6906eae 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -1,8 +1,35 @@ Describe "Test-Format-List" { It "Should call format list without error" { - { Get-Process | Format-List } | Should Not Throw + $input = New-Object PSObject + Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - { Get-Process | fl } | Should Not Throw + { $input | Format-List } | Should Not Throw + + } + + It "Should be able to call the alias" { + $input = New-Object PSObject + Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue + + { $input | fl } | Should Not Throw + + } + + It "Should have the same output whether choosing alias or not" { + $input = New-Object PSObject + Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue + + $input | fl | Out-String | Should Be ($input | Format-List | Out-String) + } + + It "Should produce the expected output" { + $expected = "`n`ntestName : testValue`n`n`n`n" + $input = New-Object PSObject + Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue + + ($input | Format-List ) | Should Not BeNullOrEmpty + ($input | Format-List | Out-String) | Should Not BeNullOrEmpty + ($input | Format-List | Out-String) | Should Be $expected } It "Should be able to call format list on piped in variable objects" { @@ -10,50 +37,50 @@ Describe "Test-Format-List" { { $a | Format-List } | Should Not Throw - { $a | fl } | Should Not Throw } It "Should be able to call a property of the piped input" { - #Tested on two input commands to veryify functionality. - $testCommand1 = Get-Process - $testCommand2 = Get-Date + # Tested on two input commands to verify functionality. - { $testCommand1 | Format-List -Property Name } | Should Not Throw - { $testCommand2 | Format-List -Property DisplayName } | Should Not Throw + { Get-Process| Format-List -Property Name } | Should Not Throw + { Get-Date | Format-List -Property DisplayName } | Should Not Throw - - { $testCommand1 | fl -Property Name } | Should Not Throw - { $testCommand2 | fl -Property DisplayName } | Should Not Throw } It "Should be able to display a list of props when separated by a comma" { - $testCommand = Get-Process + { Get-Process | 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 + ( Get-Process | Format-List -Property Name,BasePriority | Out-String).Contains("Name") | Should Be $true + ( Get-Process | Format-List -Property Name,BasePriority | Out-String).Contains("BasePriority") | Should Be $true + } It "Should not show anything other than the requested props" { - $testCommand = Get-Process - <# the structure of the output of format-list, although iterable, is not a proper collection of objects we can test + <# the structure of the output of format-list, although iterable, is not a proper collection of + objects we can test - gps | fl | ForEach-Object{$_.ToString()} confirms that each item is a format object. - - (Get-Process | Format-List | Out-String).split("\n") | ForEach-Object { $_} will list objects, but not allow interaction with them. + gps | fl | ForEach-Object{$_.ToString()} confirms that each item is a format object. + (Get-Process | Format-List | Out-String).split("\n") | ForEach-Object { $_} will list objects, + but not allow interaction with them. #> - ( $testCommand | Format-List | Out-String).Contains("CPU") | Should Be $true - ( $testCommand | Format-List -Property Name | Out-String).Contains("CPU") | Should Be $false + + + ( Get-Process | Format-List | Out-String).Contains("CPU") | Should Be $true + ( Get-Process | Format-List -Property Name | Out-String).Contains("CPU") | Should Be $false + + ( Get-Process | Format-List -Property Name | Out-String).Contains("Id") | Should Be $false + ( Get-Process | Format-List -Property Name | Out-String).Contains("Handle") | Should Be $false } It "Should be able to take input without piping objects to it" { - $input = (Get-Process)[0] + $input = New-Object PSObject + Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue { Format-List -InputObject $input } | Should Not Throw - { fl -InputObject $input } | Should Not Throw } } From bbed466ada2863b2cdde82b3de5c4987ddb3236f Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 7 Aug 2015 10:12:37 -0700 Subject: [PATCH 06/12] resolved style and readability comments --- src/pester-tests/Test-Format-List.Tests.ps1 | 46 +++++++++++---------- 1 file changed, 25 insertions(+), 21 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index cd6906eae..9f070082e 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -19,7 +19,11 @@ Describe "Test-Format-List" { $input = New-Object PSObject Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - $input | fl | Out-String | Should Be ($input | Format-List | Out-String) + $expected = $input | Format-List | Out-String + $actual = $input | fl | Out-String + + $actual | Should Be $expected + } It "Should produce the expected output" { @@ -27,33 +31,29 @@ Describe "Test-Format-List" { $input = New-Object PSObject Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - ($input | Format-List ) | Should Not BeNullOrEmpty - ($input | Format-List | Out-String) | Should Not BeNullOrEmpty - ($input | Format-List | Out-String) | Should Be $expected - } - - It "Should be able to call format list on piped in variable objects" { - $a = Get-Process - - { $a | Format-List } | Should Not Throw - + $input | Format-List | Should Not BeNullOrEmpty + $input | Format-List | Out-String | Should Not BeNullOrEmpty + $input | Format-List | Out-String | Should Be $expected } It "Should be able to call a property of the piped input" { # Tested on two input commands to verify functionality. - { Get-Process| Format-List -Property Name } | Should Not Throw - { Get-Date | Format-List -Property DisplayName } | Should Not Throw + { Get-Process | Format-List -Property Name } | Should Not Throw + { Get-Process | Format-List -Property Name } | Should Not BeNullOrEmpty + + { Get-Date | Format-List -Property DisplayName } | Should Not Throw + { Get-Date | Format-List -Property DisplayName } | Should Not BeNullOrEmpty } It "Should be able to display a list of props when separated by a comma" { { Get-Process | Format-List -Property Name,BasePriority } | Should Not Throw + $output = ( Get-Process | Format-List -Property Name,BasePriority | Out-String) - ( Get-Process | Format-List -Property Name,BasePriority | Out-String).Contains("Name") | Should Be $true - ( Get-Process | Format-List -Property Name,BasePriority | Out-String).Contains("BasePriority") | Should Be $true - + $output.Contains("Name") | Should Be $true + $output.Contains("BasePriority") | Should Be $true } It "Should not show anything other than the requested props" { @@ -66,20 +66,24 @@ Describe "Test-Format-List" { but not allow interaction with them. #> + ( Get-Process | Format-List | Out-String).Contains("CPU") | Should Be $true - ( Get-Process | Format-List | Out-String).Contains("CPU") | Should Be $true - ( Get-Process | Format-List -Property Name | Out-String).Contains("CPU") | Should Be $false + $output = ( Get-Process | Format-List -Property Name | Out-String) - ( Get-Process | Format-List -Property Name | Out-String).Contains("Id") | Should Be $false - ( Get-Process | Format-List -Property Name | Out-String).Contains("Handle") | Should Be $false + $output.Contains("CPU") | Should Be $false + $output.Contains("Id") | Should Be $false + $output.Contains("Handle") | Should Be $false } It "Should be able to take input without piping objects to it" { $input = New-Object PSObject Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - { Format-List -InputObject $input } | Should Not Throw + $output = { Format-List -InputObject $input } + + $output | Should Not Throw + $output | Should Not BeNullOrEmpty } From a8a8e2091c2fc26250e24c7c5e9bf0e368ebe651 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 7 Aug 2015 11:31:50 -0700 Subject: [PATCH 07/12] changed filtering test to be better --- src/pester-tests/Test-Format-List.Tests.ps1 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 9f070082e..4b9deeaf1 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -71,9 +71,20 @@ Describe "Test-Format-List" { $output = ( Get-Process | Format-List -Property Name | Out-String) - $output.Contains("CPU") | Should Be $false - $output.Contains("Id") | Should Be $false - $output.Contains("Handle") | Should Be $false + $output | Should Not Match "CPU" + $output | Should Not Match "Id" + $output | Should Not Match "Handle" + + # Testing each element of format-list, using a for-each loop since the Format-List is so opaque + (Get-Process | Format-List -Property CPU | Out-String) -Split "`n" | + Where-Object { + $_.trim() -ne "" + } | + + ForEach-Object{ + $_ | Should Match "CPU :" + } + } It "Should be able to take input without piping objects to it" { From 22348bdb91729706e0752f6e526ff7083bef21eb Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 7 Aug 2015 11:34:36 -0700 Subject: [PATCH 08/12] removed unnecessary comments and matched style --- src/pester-tests/Test-Format-List.Tests.ps1 | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 4b9deeaf1..6be3cf037 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -57,17 +57,7 @@ Describe "Test-Format-List" { } It "Should not show anything other than the requested props" { - <# the structure of the output of format-list, although iterable, is not a proper collection of - objects we can test - - gps | fl | ForEach-Object{$_.ToString()} confirms that each item is a format object. - - (Get-Process | Format-List | Out-String).split("\n") | ForEach-Object { $_} will list objects, - but not allow interaction with them. - #> - - ( Get-Process | Format-List | Out-String).Contains("CPU") | Should Be $true - + ( Get-Process | Format-List | Out-String) | Should Match "CPU" $output = ( Get-Process | Format-List -Property Name | Out-String) From f4e84a84bd7fc94862e3f70266a62203872882ae Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 7 Aug 2015 14:07:03 -0700 Subject: [PATCH 09/12] Refactor and add tests --- src/pester-tests/Test-Format-List.Tests.ps1 | 31 ++++++++------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 6be3cf037..e9f2ebe77 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -4,6 +4,7 @@ Describe "Test-Format-List" { Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue { $input | Format-List } | Should Not Throw + { $input | Format-List } | Should Not BeNullOrEmpty } @@ -12,6 +13,7 @@ Describe "Test-Format-List" { Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue { $input | fl } | Should Not Throw + { $input | fl } | Should Not BeNullOrEmpty } @@ -51,41 +53,30 @@ Describe "Test-Format-List" { { Get-Process | Format-List -Property Name,BasePriority } | Should Not Throw $output = ( Get-Process | Format-List -Property Name,BasePriority | Out-String) + } - $output.Contains("Name") | Should Be $true - $output.Contains("BasePriority") | Should Be $true + It "Should show the requested prop in every element" { + # Testing each element of format-list, using a for-each loop since the Format-List is so opaque + (Get-Process | Format-List -Property CPU | Out-String) -Split "`n" | + Where-Object { $_.trim() -ne "" } | + ForEach-Object {$_ | Should Match "CPU :" } } It "Should not show anything other than the requested props" { - ( Get-Process | Format-List | Out-String) | Should Match "CPU" - - $output = ( Get-Process | Format-List -Property Name | Out-String) + $output = Get-Process | Format-List -Property Name | Out-String $output | Should Not Match "CPU" $output | Should Not Match "Id" $output | Should Not Match "Handle" - - # Testing each element of format-list, using a for-each loop since the Format-List is so opaque - (Get-Process | Format-List -Property CPU | Out-String) -Split "`n" | - Where-Object { - $_.trim() -ne "" - } | - - ForEach-Object{ - $_ | Should Match "CPU :" - } - } It "Should be able to take input without piping objects to it" { $input = New-Object PSObject Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - $output = { Format-List -InputObject $input } - $output | Should Not Throw - $output | Should Not BeNullOrEmpty + $output | Should Not Throw + $output | Should Not BeNullOrEmpty } - } From fd8a9d25ac416f4ef10b8643044afb742abe0cc4 Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 7 Aug 2015 14:12:40 -0700 Subject: [PATCH 10/12] added a beforeEach clause --- src/pester-tests/Test-Format-List.Tests.ps1 | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index 6be3cf037..1eebdb19e 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -1,24 +1,18 @@ Describe "Test-Format-List" { - It "Should call format list without error" { + BeforeEach { $input = New-Object PSObject Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue + } + It "Should call format list without error" { { $input | Format-List } | Should Not Throw - } It "Should be able to call the alias" { - $input = New-Object PSObject - Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - { $input | fl } | Should Not Throw - } It "Should have the same output whether choosing alias or not" { - $input = New-Object PSObject - Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - $expected = $input | Format-List | Out-String $actual = $input | fl | Out-String @@ -78,10 +72,7 @@ Describe "Test-Format-List" { } It "Should be able to take input without piping objects to it" { - $input = New-Object PSObject - Add-Member -InputObject $input -MemberType NoteProperty -Name testName -Value testValue - - $output = { Format-List -InputObject $input } + $output = { Format-List -InputObject $input } $output | Should Not Throw $output | Should Not BeNullOrEmpty From d35e13afdb96705131cb4809aecf6e26a392bcc8 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 7 Aug 2015 14:39:17 -0700 Subject: [PATCH 11/12] Fix list of props test and merge cruft --- src/pester-tests/Test-Format-List.Tests.ps1 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index af25885c2..da0069abb 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -7,13 +7,11 @@ Describe "Test-Format-List" { It "Should call format list without error" { { $input | Format-List } | Should Not Throw { $input | Format-List } | Should Not BeNullOrEmpty - } It "Should be able to call the alias" { { $input | fl } | Should Not Throw { $input | fl } | Should Not BeNullOrEmpty - } It "Should have the same output whether choosing alias or not" { @@ -21,7 +19,6 @@ Describe "Test-Format-List" { $actual = $input | fl | Out-String $actual | Should Be $expected - } It "Should produce the expected output" { @@ -36,26 +33,26 @@ Describe "Test-Format-List" { It "Should be able to call a property of the piped input" { # Tested on two input commands to verify functionality. - { Get-Process | Format-List -Property Name } | Should Not Throw { Get-Process | Format-List -Property Name } | Should Not BeNullOrEmpty { Get-Date | Format-List -Property DisplayName } | Should Not Throw { Get-Date | Format-List -Property DisplayName } | Should Not BeNullOrEmpty - } It "Should be able to display a list of props when separated by a comma" { { Get-Process | Format-List -Property Name,BasePriority } | Should Not Throw - $output = ( Get-Process | Format-List -Property Name,BasePriority | Out-String) + (Get-Process | Format-List -Property Name,BasePriority | Out-String) -Split "`n" | + Where-Object { $_.trim() -ne "" } | + ForEach-Object { $_ | Should Match "(Name)|(BasePriority)" } } It "Should show the requested prop in every element" { # Testing each element of format-list, using a for-each loop since the Format-List is so opaque (Get-Process | Format-List -Property CPU | Out-String) -Split "`n" | Where-Object { $_.trim() -ne "" } | - ForEach-Object {$_ | Should Match "CPU :" } + ForEach-Object { $_ | Should Match "CPU :" } } It "Should not show anything other than the requested props" { @@ -67,8 +64,6 @@ Describe "Test-Format-List" { } It "Should be able to take input without piping objects to it" { - $output = { Format-List -InputObject $input } - $output = { Format-List -InputObject $input } $output | Should Not Throw From 749a92dff80ca2f82f489beba3508b81fce8108a Mon Sep 17 00:00:00 2001 From: Zachary Folwick Date: Fri, 7 Aug 2015 14:52:19 -0700 Subject: [PATCH 12/12] made string calls more precise --- src/pester-tests/Test-Format-List.Tests.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/pester-tests/Test-Format-List.Tests.ps1 b/src/pester-tests/Test-Format-List.Tests.ps1 index da0069abb..d284128dd 100644 --- a/src/pester-tests/Test-Format-List.Tests.ps1 +++ b/src/pester-tests/Test-Format-List.Tests.ps1 @@ -58,9 +58,9 @@ Describe "Test-Format-List" { It "Should not show anything other than the requested props" { $output = Get-Process | Format-List -Property Name | Out-String - $output | Should Not Match "CPU" - $output | Should Not Match "Id" - $output | Should Not Match "Handle" + $output | Should Not Match "CPU :" + $output | Should Not Match "Id :" + $output | Should Not Match "Handle :" } It "Should be able to take input without piping objects to it" {