diff --git a/test/powershell/ConsoleHost.Tests.ps1 b/test/powershell/ConsoleHost.Tests.ps1 index 79272b119..69ea6a532 100644 --- a/test/powershell/ConsoleHost.Tests.ps1 +++ b/test/powershell/ConsoleHost.Tests.ps1 @@ -4,11 +4,11 @@ Describe "ConsoleHost unit tests" { $powershell = Join-Path -Path $PsHome -ChildPath "powershell" Context "CommandLine" { - It "simple -args" { + It "simple -args" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { & $powershell -noprofile { $args[0] } -args "hello world" | Should Be "hello world" } - It "array -args" { + It "array -args" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { & $powershell -noprofile { $args[0] } -args 1,(2,3) | Should Be 1 (& $powershell -noprofile { $args[1] } -args 1,(2,3))[1] | Should Be 3 } @@ -37,7 +37,7 @@ Describe "ConsoleHost unit tests" { $p | & $powershell -noprofile -inputFormat xml { $input | Foreach-Object {$a = 0} { $a += $_.X + $_.Y } { $a } } | Should Be 30 } - It "text input" { + It "text input" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { # Join (multiple lines) and remove whitespace (we don't care about spacing) to verify we converted to string (by generating a table) $p | & $powershell -noprofile -inputFormat text { -join ($input -replace "\s","") } | Should Be "XY--1020" } @@ -47,7 +47,7 @@ Describe "ConsoleHost unit tests" { & $powershell -noprofile -outputFormat xml { [PSCustomObject]@{X=10;Y=20} } | Foreach-Object {$a = 0} { $a += $_.X + $_.Y } { $a } | Should Be 30 } - It "text output" { + It "text output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { # Join (multiple lines) and remove whitespace (we don't care about spacing) to verify we converted to string (by generating a table) -join (& $powershell -noprofile -outputFormat text { [PSCustomObject]@{X=10;Y=20} }) -replace "\s","" | Should Be "XY--1020" } @@ -84,7 +84,7 @@ Describe "ConsoleHost unit tests" { } } - It "Simple redirected output" { + It "Simple redirected output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $si = NewProcessStartInfo "-noprofile 1+1" $process = RunPowerShell $si $process.StandardOutput.ReadToEnd() | Should Be 2 diff --git a/test/powershell/Format-Custom.Tests.ps1 b/test/powershell/Format-Custom.Tests.ps1 index df7d1144c..7c7782e87 100644 --- a/test/powershell/Format-Custom.Tests.ps1 +++ b/test/powershell/Format-Custom.Tests.ps1 @@ -26,19 +26,19 @@ Describe "Format-Custom" { Describe "Format-Custom DRT basic functionality" -Tags DRT{ - It "Format-Custom with subobject should work"{ - $expectResult1 = "this is the name" - $expectResult2 = "this is the name of the sub object" - $testObject = @{} - $testObject.name = $expectResult1 - $testObject.subObjectValue = @{} - $testObject.subObjectValue.name = $expectResult2 - $testObject.subObjectValue.array = (0..63) - $testObject.subObjectValue.stringarray = @("one","two") - $result = $testObject | Format-Custom | Out-String - $result | Should Match $expectResult1 - $result | Should Match $expectResult2 - $result | Should Match "one" - $result | Should Match "two" - } -} \ No newline at end of file + It "Format-Custom with subobject should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $expectResult1 = "this is the name" + $expectResult2 = "this is the name of the sub object" + $testObject = @{} + $testObject.name = $expectResult1 + $testObject.subObjectValue = @{} + $testObject.subObjectValue.name = $expectResult2 + $testObject.subObjectValue.array = (0..63) + $testObject.subObjectValue.stringarray = @("one","two") + $result = $testObject | Format-Custom | Out-String + $result | Should Match $expectResult1 + $result | Should Match $expectResult2 + $result | Should Match "one" + $result | Should Match "two" + } +} diff --git a/test/powershell/Format-List.Tests.ps1 b/test/powershell/Format-List.Tests.ps1 index 782456551..29ad7cd0b 100644 --- a/test/powershell/Format-List.Tests.ps1 +++ b/test/powershell/Format-List.Tests.ps1 @@ -20,7 +20,7 @@ Describe "Format-List" { $actual | Should Be $expected } - It "Should produce the expected output" { + It "Should produce the expected output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}" $in = New-Object PSObject Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue @@ -68,14 +68,14 @@ Describe "Format-List" { } Describe "Format-List DRT basic functionality" -Tags DRT{ - It "Format-List with array should work"{ - $al = (0..255) - $info = @{} - $info.array = $al - $result = $info | Format-List | Out-String - $result | Should Match "Name : array\s+Value : {0, 1, 2, 3...}" - } - + It "Format-List with array should work"-Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $al = (0..255) + $info = @{} + $info.array = $al + $result = $info | Format-List | Out-String + $result | Should Match "Name : array\s+Value : {0, 1, 2, 3...}" + } + It "Format-List with No Objects for End-To-End should work"{ $p = @{} $result = $p | Format-List -Force -Property "foo","bar" | Out-String @@ -106,22 +106,22 @@ Describe "Format-List DRT basic functionality" -Tags DRT{ $result.Trim() | Should BeNullOrEmpty } - It "Format-List with complex object for End-To-End should work"{ - Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" - $eto = New-Object MyDayOfWeek - $info = @{} - $info.intArray = 1,2,3,4 - $info.arrayList = "string1","string2" - $info.enumerable = [MyDayOfWeek]$eto - $info.enumerableTestObject = $eto - $result = $info|Format-List|Out-String - $result | Should Match "Name : enumerableTestObject" - $result | Should Match "Value : Sun" - $result | Should Match "Name : arrayList" - $result | Should Match "Value : {string1, string2}" - $result | Should Match "Name : enumerable" - $result | Should Match "Value : Sun" - $result | Should Match "Name : intArray" - $result | Should Match "Value : {1, 2, 3, 4}" - } + It "Format-List with complex object for End-To-End should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" + $eto = New-Object MyDayOfWeek + $info = @{} + $info.intArray = 1,2,3,4 + $info.arrayList = "string1","string2" + $info.enumerable = [MyDayOfWeek]$eto + $info.enumerableTestObject = $eto + $result = $info|Format-List|Out-String + $result | Should Match "Name : enumerableTestObject" + $result | Should Match "Value : Sun" + $result | Should Match "Name : arrayList" + $result | Should Match "Value : {string1, string2}" + $result | Should Match "Name : enumerable" + $result | Should Match "Value : Sun" + $result | Should Match "Name : intArray" + $result | Should Match "Value : {1, 2, 3, 4}" + } } diff --git a/test/powershell/Format-Table.Tests.ps1 b/test/powershell/Format-Table.Tests.ps1 index b8e939c3e..5f85a76f9 100644 --- a/test/powershell/Format-Table.Tests.ps1 +++ b/test/powershell/Format-Table.Tests.ps1 @@ -1,213 +1,213 @@ Describe "Format-Table" { - It "Should call format table on piped input without error" { - { Get-Date | Format-Table } | Should Not Throw + It "Should call format table on piped input without error" { + { Get-Date | Format-Table } | Should Not Throw - { Get-Date | ft } | Should Not Throw - } + { Get-Date | ft } | Should Not Throw + } - It "Should return a format object data type" { - $val = (Get-Date | Format-Table | gm ) + It "Should return a format object data type" { + $val = (Get-Date | Format-Table | gm ) - $val2 = (Get-Date | Format-Table | gm ) + $val2 = (Get-Date | Format-Table | gm ) - $val.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format" + $val.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format" - $val2.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format" - } + $val2.TypeName | Should Match "Microsoft.Powershell.Commands.Internal.Format" + } - It "Should be able to be called with optional parameters" { - $v1 = (Get-Date | Format-Table *) - $v2 = (Get-Date | Format-Table -Property Hour) - $v3 = (Get-Date | Format-Table -GroupBy Hour) + It "Should be able to be called with optional parameters" { + $v1 = (Get-Date | Format-Table *) + $v2 = (Get-Date | Format-Table -Property Hour) + $v3 = (Get-Date | Format-Table -GroupBy Hour) - $v12 = (Get-Date | ft *) - $v22 = (Get-Date | ft -Property Hour) - $v32 = (Get-Date | ft -GroupBy Hour) + $v12 = (Get-Date | ft *) + $v22 = (Get-Date | ft -Property Hour) + $v32 = (Get-Date | ft -GroupBy Hour) - } + } } Describe "Format-Table DRT Unit Tests" -Tags DRT{ - It "Format-Table with not existing table with force should throw PipelineStoppedException"{ - $obj = New-Object -typename PSObject - try - { - $obj | Format-Table -view bar -force -EA Stop - Throw "Execution OK" + It "Format-Table with not existing table with force should throw PipelineStoppedException"{ + $obj = New-Object -typename PSObject + try + { + $obj | Format-Table -view bar -force -EA Stop + Throw "Execution OK" + } + catch + { + $_.CategoryInfo | Should Match "PipelineStoppedException" + $_.FullyQualifiedErrorId | Should be "FormatViewNotFound,Microsoft.PowerShell.Commands.FormatTableCommand" + } } - catch - { - $_.CategoryInfo | Should Match "PipelineStoppedException" - $_.FullyQualifiedErrorId | Should be "FormatViewNotFound,Microsoft.PowerShell.Commands.FormatTableCommand" + + It "Format-Table with array should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $al = (0..255) + $info = @{} + $info.array = $al + $result = $info|Format-Table|Out-String + $result | Should Match "array\s+{0, 1, 2, 3...}" } - } - - It "Format-Table with array should work"{ - $al = (0..255) - $info = @{} - $info.array = $al - $result = $info|Format-Table|Out-String - $result | Should Match "array\s+{0, 1, 2, 3...}" - } - - It "Format-Table with Negative Count should work"{ - $FormatEnumerationLimit = -1 - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{1, 2}" - } - - #pending on issue#888 - It "Format-Table with Zero Count should work" -pending{ - $FormatEnumerationLimit = 0 - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{...}" - } - - It "Format-Table with Less Count should work"{ - $FormatEnumerationLimit = 1 - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{1...}" - } - - It "Format-Table with More Count should work"{ - $FormatEnumerationLimit = 10 - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{1, 2}" - } - - It "Format-Table with Equal Count should work"{ - $FormatEnumerationLimit = 2 - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{1, 2}" - } - - #pending on issue#888 - It "Format-Table with Bogus Count should throw Exception" -pending{ - $FormatEnumerationLimit = "abc" - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{1, 2}" - } - - #pending on issue#888 - It "Format-Table with Var Deleted should throw Exception" -pending{ - $FormatEnumerationLimit = 2 - Remove-Variable FormatEnumerationLimit - $result = Format-Table -inputobject @{'test'= 1, 2} - $resultStr = $result|Out-String - $resultStr | Should Match "test\s+{1, 2}" - } - - It "Format-Table with new line should work"{ - $info = @{} - $info.name = "1\n2" - $result = $info|Format-Table|Out-String - $result | Should Match "name\s+1.+2" - } - - It "Format-Table with ExposeBug920454 should work"{ - $IP1 = [System.Net.IPAddress]::Parse("1.1.1.1") - $IP2 = [System.Net.IPAddress]::Parse("4fde:0000:0000:0002:0022:f376:255.59.171.63") - $IPs = New-Object System.Collections.ArrayList - $IPs.Add($IP1) - $IPs.Add($IP2) - $info = @{} - $info.test = $IPs - $result = $info|Format-Table|Out-String - $result | Should Match "test\s+{1.1.1.1, 4fde::2:22:f376:ff3b:ab3f}" - } - - It "Format-Table with Autosize should work"{ - $IP1 = [PSCustomObject]@{'name'='Bob';'size'=1234;'booleanValue'=$true;} - $IP2 = [PSCustomObject]@{'name'='Jim';'size'=5678;'booleanValue'=$false;} - $IPs = New-Object System.Collections.ArrayList - $IPs.Add($IP1) - $IPs.Add($IP2) - $result = $IPs|Format-Table -Autosize|Out-String - $result | Should Match "name size booleanValue" - $result | Should Match "---- ---- ------------" - $result | Should Match "Bob\s+1234\s+True" - $result | Should Match "Jim\s+5678\s+False" - } - - It "Format-Table with No Objects for End-To-End should work"{ - $p = @{} - $result = $p|Format-Table -Property "foo","bar"|Out-String - $result | Should BeNullOrEmpty - } - - It "Format-Table with Null Objects for End-To-End should work"{ - $p = $null - $result = $p|Format-Table -Property "foo","bar"|Out-String - $result | Should BeNullOrEmpty - } - - #pending on issue#900 - It "Format-Table with single line string for End-To-End should work" -pending{ - $p = "single line string" - $result = $p|Format-Table -Property "foo","bar"|Out-String - $result | Should BeNullOrEmpty - } - - #pending on issue#900 - It "Format-Table with multiple line string for End-To-End should work" -pending{ - $p = "Line1\nLine2" - $result = $p|Format-Table -Property "foo","bar"|Out-String - $result | Should BeNullOrEmpty - } - - #pending on issue#900 - It "Format-Table with string sequence for End-To-End should work" -pending{ - $p = "Line1","Line2" - $result = $p|Format-Table -Property "foo","bar"|Out-String - $result | Should BeNullOrEmpty - } - - #pending on issue#900 - It "Format-Table with string sequence for End-To-End should work" -pending{ - $p = "Line1","Line2" - $result = $p|Format-Table -Property "foo","bar"|Out-String - $result | Should BeNullOrEmpty - } - - It "Format-Table with complex object for End-To-End should work"{ - Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" - $eto = New-Object MyDayOfWeek - $info = @{} - $info.intArray = 1,2,3,4 - $info.arrayList = "string1","string2" - $info.enumerable = [MyDayOfWeek]$eto - $info.enumerableTestObject = $eto - $result = $info|Format-Table|Out-String - $result | Should Match "intArray\s+{1, 2, 3, 4}" - $result | Should Match "arrayList\s+{string1, string2}" - $result | Should Match "enumerable\s+Sun" - $result | Should Match "enumerableTestObject\s+Sun" - } - - It "Format-Table with Expand Enumerable should work"{ - $obj1 = "x 0","y 0" - $obj2 = "x 1","y 1" - $objs = New-Object System.Collections.ArrayList - $objs.Add($obj1) - $objs.Add($obj2) - $mo = [PSCustomObject]@{name = "this is name";sub = $objs} - $result1 = $mo|Format-Table -Expand CoreOnly|Out-String - $result1 | Should Match "name\s+sub" - $result1 | Should Match "this is name" - - $result2 = $mo|Format-Table -Expand EnumOnly|Out-String - $result2 | Should Match "name\s+sub" - $result2 | Should Match "this is name\s+{x 0 y 0, x 1 y 1}" - - $result3 = $mo|Format-Table -Expand Both|Out-String - $result3 | Should Match "name\s+sub" - $result3 | Should Match "this is name\s+{x 0 y 0, x 1 y 1}" - } -} \ No newline at end of file + + It "Format-Table with Negative Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $FormatEnumerationLimit = -1 + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{1, 2}" + } + + # Pending on issue#888 + It "Format-Table with Zero Count should work" -Pending { + $FormatEnumerationLimit = 0 + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{...}" + } + + It "Format-Table with Less Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $FormatEnumerationLimit = 1 + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{1...}" + } + + It "Format-Table with More Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $FormatEnumerationLimit = 10 + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{1, 2}" + } + + It "Format-Table with Equal Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $FormatEnumerationLimit = 2 + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{1, 2}" + } + + # Pending on issue#888 + It "Format-Table with Bogus Count should throw Exception" -Pending { + $FormatEnumerationLimit = "abc" + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{1, 2}" + } + + # Pending on issue#888 + It "Format-Table with Var Deleted should throw Exception" -Pending { + $FormatEnumerationLimit = 2 + Remove-Variable FormatEnumerationLimit + $result = Format-Table -inputobject @{'test'= 1, 2} + $resultStr = $result|Out-String + $resultStr | Should Match "test\s+{1, 2}" + } + + It "Format-Table with new line should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $info = @{} + $info.name = "1\n2" + $result = $info|Format-Table|Out-String + $result | Should Match "name\s+1.+2" + } + + It "Format-Table with ExposeBug920454 should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $IP1 = [System.Net.IPAddress]::Parse("1.1.1.1") + $IP2 = [System.Net.IPAddress]::Parse("4fde:0000:0000:0002:0022:f376:255.59.171.63") + $IPs = New-Object System.Collections.ArrayList + $IPs.Add($IP1) + $IPs.Add($IP2) + $info = @{} + $info.test = $IPs + $result = $info|Format-Table|Out-String + $result | Should Match "test\s+{1.1.1.1, 4fde::2:22:f376:ff3b:ab3f}" + } + + It "Format-Table with Autosize should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $IP1 = [PSCustomObject]@{'name'='Bob';'size'=1234;'booleanValue'=$true;} + $IP2 = [PSCustomObject]@{'name'='Jim';'size'=5678;'booleanValue'=$false;} + $IPs = New-Object System.Collections.ArrayList + $IPs.Add($IP1) + $IPs.Add($IP2) + $result = $IPs|Format-Table -Autosize|Out-String + $result | Should Match "name size booleanValue" + $result | Should Match "---- ---- ------------" + $result | Should Match "Bob\s+1234\s+True" + $result | Should Match "Jim\s+5678\s+False" + } + + It "Format-Table with No Objects for End-To-End should work"{ + $p = @{} + $result = $p|Format-Table -Property "foo","bar"|Out-String + $result | Should BeNullOrEmpty + } + + It "Format-Table with Null Objects for End-To-End should work"{ + $p = $null + $result = $p|Format-Table -Property "foo","bar"|Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-Table with single line string for End-To-End should work" -pending{ + $p = "single line string" + $result = $p|Format-Table -Property "foo","bar"|Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-Table with multiple line string for End-To-End should work" -pending{ + $p = "Line1\nLine2" + $result = $p|Format-Table -Property "foo","bar"|Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-Table with string sequence for End-To-End should work" -pending{ + $p = "Line1","Line2" + $result = $p|Format-Table -Property "foo","bar"|Out-String + $result | Should BeNullOrEmpty + } + + #pending on issue#900 + It "Format-Table with string sequence for End-To-End should work" -pending{ + $p = "Line1","Line2" + $result = $p|Format-Table -Property "foo","bar"|Out-String + $result | Should BeNullOrEmpty + } + + It "Format-Table with complex object for End-To-End should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" + $eto = New-Object MyDayOfWeek + $info = @{} + $info.intArray = 1,2,3,4 + $info.arrayList = "string1","string2" + $info.enumerable = [MyDayOfWeek]$eto + $info.enumerableTestObject = $eto + $result = $info|Format-Table|Out-String + $result | Should Match "intArray\s+{1, 2, 3, 4}" + $result | Should Match "arrayList\s+{string1, string2}" + $result | Should Match "enumerable\s+Sun" + $result | Should Match "enumerableTestObject\s+Sun" + } + + It "Format-Table with Expand Enumerable should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + $obj1 = "x 0","y 0" + $obj2 = "x 1","y 1" + $objs = New-Object System.Collections.ArrayList + $objs.Add($obj1) + $objs.Add($obj2) + $mo = [PSCustomObject]@{name = "this is name";sub = $objs} + $result1 = $mo|Format-Table -Expand CoreOnly|Out-String + $result1 | Should Match "name\s+sub" + $result1 | Should Match "this is name" + + $result2 = $mo|Format-Table -Expand EnumOnly|Out-String + $result2 | Should Match "name\s+sub" + $result2 | Should Match "this is name\s+{x 0 y 0, x 1 y 1}" + + $result3 = $mo|Format-Table -Expand Both|Out-String + $result3 | Should Match "name\s+sub" + $result3 | Should Match "this is name\s+{x 0 y 0, x 1 y 1}" + } +} diff --git a/test/powershell/Format-Wide.Tests.ps1 b/test/powershell/Format-Wide.Tests.ps1 index c4e9a5862..89e33dfac 100644 --- a/test/powershell/Format-Wide.Tests.ps1 +++ b/test/powershell/Format-Wide.Tests.ps1 @@ -40,7 +40,7 @@ Describe "Format-Wide" { } Describe "Format-Wide DRT basic functionality" -Tags DRT{ - It "Format-Wide with array should work"{ + It "Format-Wide with array should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $al = (0..255) $info = @{} $info.array = $al @@ -80,7 +80,7 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{ $result | Should Match "Line2" } - It "Format-Wide with complex object for End-To-End should work"{ + It "Format-Wide with complex object for End-To-End should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" $eto = New-Object MyDayOfWeek $info = @{} @@ -94,4 +94,4 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{ $result | Should Match "enumerable" $result | Should Match "enumerableTestObject" } -} \ No newline at end of file +} diff --git a/test/powershell/Get-Date.Tests.ps1 b/test/powershell/Get-Date.Tests.ps1 index 69f113fb7..f43021dcc 100644 --- a/test/powershell/Get-Date.Tests.ps1 +++ b/test/powershell/Get-Date.Tests.ps1 @@ -12,7 +12,7 @@ Describe "Get-Date DRT Unit Tests" -Tags DRT { $result.Millisecond | Should be 200 } - It "using -displayhint produces the correct output" { + It "using -displayhint produces the correct output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $d = Get-date -Date:"Jan 1, 2020" -DisplayHint Date | Out-String $d.Trim() | Should be "Wednesday, January 1, 2020" } diff --git a/test/powershell/Out-File.Tests.ps1 b/test/powershell/Out-File.Tests.ps1 index c3dafc914..75732b9d5 100644 --- a/test/powershell/Out-File.Tests.ps1 +++ b/test/powershell/Out-File.Tests.ps1 @@ -52,7 +52,7 @@ Describe "Out-File" { { Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw } - It "Should not overwrite when the noclobber switch is used" { + It "Should not overwrite when the noclobber switch is used" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { Out-File -FilePath $testfile -InputObject $inObject @@ -67,7 +67,7 @@ Describe "Out-File" { $actual[3] | Should Match "some test text" } - It "Should Append a new line when the append switch is used" { + It "Should Append a new line when the append switch is used" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { { Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw { Out-File -FilePath $testfile -InputObject $inObject -Append } | Should Not Throw @@ -101,7 +101,7 @@ Describe "Out-File" { } - It "Should allow the cmdlet to overwrite an existing read-only file" { + It "Should allow the cmdlet to overwrite an existing read-only file" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { # create a read-only text file { Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw Set-ItemProperty -Path $testfile -Name IsReadOnly -Value $true diff --git a/test/powershell/Out-String.Tests.ps1 b/test/powershell/Out-String.Tests.ps1 index 841a4ffe6..c4c5c5133 100644 --- a/test/powershell/Out-String.Tests.ps1 +++ b/test/powershell/Out-String.Tests.ps1 @@ -1,6 +1,6 @@ Describe "Out-String DRT Unit Tests" -Tags DRT{ - It "check display of properties with names containing wildcard characters" { + It "check display of properties with names containing wildcard characters" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $results = new-object psobject | add-member -passthru noteproperty 'name with square brackets: [0]' 'myvalue' | out-string $results.Length | Should BeGreaterThan 1 $results.GetType() | Should Be string diff --git a/test/powershell/Set-Variable.Tests.ps1 b/test/powershell/Set-Variable.Tests.ps1 index 9b12fb010..18e04f887 100644 --- a/test/powershell/Set-Variable.Tests.ps1 +++ b/test/powershell/Set-Variable.Tests.ps1 @@ -208,7 +208,7 @@ Describe "Set-Variable" { $testVar | Should Be $testValue } - It "Should be able to pipe object properties to output using the PassThru switch" { + It "Should be able to pipe object properties to output using the PassThru switch" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { $in = Set-Variable -Name testVar -Value "test" -Description "test description" -PassThru $output = $in | Format-List -Property Description | Out-String diff --git a/test/powershell/Write-Stream.Tests.ps1 b/test/powershell/Write-Stream.Tests.ps1 index b0c0821d8..a7dc077c8 100644 --- a/test/powershell/Write-Stream.Tests.ps1 +++ b/test/powershell/Write-Stream.Tests.ps1 @@ -5,67 +5,67 @@ Describe "Stream writer tests" { # that would normally function Write-Messages { - [CmdletBinding()] + [CmdletBinding()] - param() - If ($PSBoundParameters['Debug']) { $DebugPreference = 'Continue' } - Write-Verbose "Verbose message" + param() + If ($PSBoundParameters['Debug']) { $DebugPreference = 'Continue' } + Write-Verbose "Verbose message" - Write-Debug "Debug message" + Write-Debug "Debug message" } function Get-OutputResults { - # Get the contents of the targetfile. - # Make the array a string for less brittle testing - $output = $(Get-Content $args[0]) - [String]::Join([Environment]::NewLine, $output ) + # Get the contents of the targetfile. + # Make the array a string for less brittle testing + $output = $(Get-Content $args[0]) + [String]::Join([Environment]::NewLine, $output ) - return $output + return $output } Context "Redirect Stream Tests" { - # These tests validate that a stream is actually being written to by redirecting the output of that stream + # These tests validate that a stream is actually being written to by redirecting the output of that stream - AfterEach { Remove-Item $targetfile } - It "Should write warnings to the warning stream" { - Write-Warning "Test Warning" 3>&1 > $targetfile + AfterEach { Remove-Item $targetfile } + It "Should write warnings to the warning stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + Write-Warning "Test Warning" 3>&1 > $targetfile - Get-Content $targetfile | Should Be "Test Warning" - } + Get-Content $targetfile | Should Be "Test Warning" + } - It "Should write error messages to the error stream" { - Write-Error "Testing Error" 2>&1 > $targetfile + It "Should write error messages to the error stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + Write-Error "Testing Error" 2>&1 > $targetfile - $result = Get-OutputResults $targetfile - # The contents of the error stream should contain the expected text - $result -match ": Testing Error" | Should Be $true - } + $result = Get-OutputResults $targetfile + # The contents of the error stream should contain the expected text + $result -match ": Testing Error" | Should Be $true + } - It "Should write debug messages to the debug stream" { - Write-Messages -Debug -EA SilentlyContinue 5>&1 > $targetfile + It "Should write debug messages to the debug stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + Write-Messages -Debug -EA SilentlyContinue 5>&1 > $targetfile - $result = Get-OutputResults $targetfile + $result = Get-OutputResults $targetfile - # The contents of the debug stream should contain the expected text - $result -match "Debug Message" | Should Be $true - } + # The contents of the debug stream should contain the expected text + $result -match "Debug Message" | Should Be $true + } - It "Should write messages to the verbose stream" { - Write-Messages -Verbose 4>&1 > $targetfile + It "Should write messages to the verbose stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") { + Write-Messages -Verbose 4>&1 > $targetfile - $result = Get-OutputResults $targetfile + $result = Get-OutputResults $targetfile - # The contents of the debug stream should contain the expected text - $result -match "Verbose Message" | Should Be $true - } + # The contents of the debug stream should contain the expected text + $result -match "Verbose Message" | Should Be $true + } } Context "Error automatic variable" { - It "Should write error messages to the `$Error automatic variable" { - Write-Error "Test Error Message" -ErrorAction SilentlyContinue + It "Should write error messages to the `$Error automatic variable" { + Write-Error "Test Error Message" -ErrorAction SilentlyContinue - $Error[0] | Should Match "Test Error Message" - } + $Error[0] | Should Match "Test Error Message" + } } }