Mark as pending Travis CI OS X failing tests

These tests *do not* fail locally, nor on the Linux test runner. They do
not fail when accessing the OS X runner under debug mode. The *only*
cause is the lack of a TTY on the OS X runner, which is a Travis CI
regression. Moreover, the formatting tests do not fail when the TTY is
removed locally.

These absolutely should be fixed at some point, but it is not worth
spending any more time on it.
This commit is contained in:
Andrew Schwartzmeyer 2016-05-13 18:23:28 -07:00
parent 44028f0da3
commit 7e65fa448e
10 changed files with 293 additions and 293 deletions

View file

@ -4,11 +4,11 @@ Describe "ConsoleHost unit tests" {
$powershell = Join-Path -Path $PsHome -ChildPath "powershell" $powershell = Join-Path -Path $PsHome -ChildPath "powershell"
Context "CommandLine" { 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" & $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[0] } -args 1,(2,3) | Should Be 1
(& $powershell -noprofile { $args[1] } -args 1,(2,3))[1] | Should Be 3 (& $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 $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) # 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" $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 & $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 (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" -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" $si = NewProcessStartInfo "-noprofile 1+1"
$process = RunPowerShell $si $process = RunPowerShell $si
$process.StandardOutput.ReadToEnd() | Should Be 2 $process.StandardOutput.ReadToEnd() | Should Be 2

View file

@ -26,19 +26,19 @@ Describe "Format-Custom" {
Describe "Format-Custom DRT basic functionality" -Tags DRT{ Describe "Format-Custom DRT basic functionality" -Tags DRT{
It "Format-Custom with subobject should work"{ It "Format-Custom with subobject should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$expectResult1 = "this is the name" $expectResult1 = "this is the name"
$expectResult2 = "this is the name of the sub object" $expectResult2 = "this is the name of the sub object"
$testObject = @{} $testObject = @{}
$testObject.name = $expectResult1 $testObject.name = $expectResult1
$testObject.subObjectValue = @{} $testObject.subObjectValue = @{}
$testObject.subObjectValue.name = $expectResult2 $testObject.subObjectValue.name = $expectResult2
$testObject.subObjectValue.array = (0..63) $testObject.subObjectValue.array = (0..63)
$testObject.subObjectValue.stringarray = @("one","two") $testObject.subObjectValue.stringarray = @("one","two")
$result = $testObject | Format-Custom | Out-String $result = $testObject | Format-Custom | Out-String
$result | Should Match $expectResult1 $result | Should Match $expectResult1
$result | Should Match $expectResult2 $result | Should Match $expectResult2
$result | Should Match "one" $result | Should Match "one"
$result | Should Match "two" $result | Should Match "two"
} }
} }

View file

@ -20,7 +20,7 @@ Describe "Format-List" {
$actual | Should Be $expected $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}" $expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}"
$in = New-Object PSObject $in = New-Object PSObject
Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue 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{ Describe "Format-List DRT basic functionality" -Tags DRT{
It "Format-List with array should work"{ It "Format-List with array should work"-Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$al = (0..255) $al = (0..255)
$info = @{} $info = @{}
$info.array = $al $info.array = $al
$result = $info | Format-List | Out-String $result = $info | Format-List | Out-String
$result | Should Match "Name : array\s+Value : {0, 1, 2, 3...}" $result | Should Match "Name : array\s+Value : {0, 1, 2, 3...}"
} }
It "Format-List with No Objects for End-To-End should work"{ It "Format-List with No Objects for End-To-End should work"{
$p = @{} $p = @{}
$result = $p | Format-List -Force -Property "foo","bar" | Out-String $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 $result.Trim() | Should BeNullOrEmpty
} }
It "Format-List with complex object for End-To-End should work"{ 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}" Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}"
$eto = New-Object MyDayOfWeek $eto = New-Object MyDayOfWeek
$info = @{} $info = @{}
$info.intArray = 1,2,3,4 $info.intArray = 1,2,3,4
$info.arrayList = "string1","string2" $info.arrayList = "string1","string2"
$info.enumerable = [MyDayOfWeek]$eto $info.enumerable = [MyDayOfWeek]$eto
$info.enumerableTestObject = $eto $info.enumerableTestObject = $eto
$result = $info|Format-List|Out-String $result = $info|Format-List|Out-String
$result | Should Match "Name : enumerableTestObject" $result | Should Match "Name : enumerableTestObject"
$result | Should Match "Value : Sun" $result | Should Match "Value : Sun"
$result | Should Match "Name : arrayList" $result | Should Match "Name : arrayList"
$result | Should Match "Value : {string1, string2}" $result | Should Match "Value : {string1, string2}"
$result | Should Match "Name : enumerable" $result | Should Match "Name : enumerable"
$result | Should Match "Value : Sun" $result | Should Match "Value : Sun"
$result | Should Match "Name : intArray" $result | Should Match "Name : intArray"
$result | Should Match "Value : {1, 2, 3, 4}" $result | Should Match "Value : {1, 2, 3, 4}"
} }
} }

View file

@ -1,213 +1,213 @@
Describe "Format-Table" { Describe "Format-Table" {
It "Should call format table on piped input without error" { It "Should call format table on piped input without error" {
{ Get-Date | Format-Table } | Should Not Throw { 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" { It "Should return a format object data type" {
$val = (Get-Date | Format-Table | gm ) $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" { It "Should be able to be called with optional parameters" {
$v1 = (Get-Date | Format-Table *) $v1 = (Get-Date | Format-Table *)
$v2 = (Get-Date | Format-Table -Property Hour) $v2 = (Get-Date | Format-Table -Property Hour)
$v3 = (Get-Date | Format-Table -GroupBy Hour) $v3 = (Get-Date | Format-Table -GroupBy Hour)
$v12 = (Get-Date | ft *) $v12 = (Get-Date | ft *)
$v22 = (Get-Date | ft -Property Hour) $v22 = (Get-Date | ft -Property Hour)
$v32 = (Get-Date | ft -GroupBy Hour) $v32 = (Get-Date | ft -GroupBy Hour)
} }
} }
Describe "Format-Table DRT Unit Tests" -Tags DRT{ Describe "Format-Table DRT Unit Tests" -Tags DRT{
It "Format-Table with not existing table with force should throw PipelineStoppedException"{ It "Format-Table with not existing table with force should throw PipelineStoppedException"{
$obj = New-Object -typename PSObject $obj = New-Object -typename PSObject
try try
{ {
$obj | Format-Table -view bar -force -EA Stop $obj | Format-Table -view bar -force -EA Stop
Throw "Execution OK" Throw "Execution OK"
}
catch
{
$_.CategoryInfo | Should Match "PipelineStoppedException"
$_.FullyQualifiedErrorId | Should be "FormatViewNotFound,Microsoft.PowerShell.Commands.FormatTableCommand"
}
} }
catch
{ It "Format-Table with array should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$_.CategoryInfo | Should Match "PipelineStoppedException" $al = (0..255)
$_.FullyQualifiedErrorId | Should be "FormatViewNotFound,Microsoft.PowerShell.Commands.FormatTableCommand" $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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
It "Format-Table with array should work"{ $FormatEnumerationLimit = -1
$al = (0..255) $result = Format-Table -inputobject @{'test'= 1, 2}
$info = @{} $resultStr = $result|Out-String
$info.array = $al $resultStr | Should Match "test\s+{1, 2}"
$result = $info|Format-Table|Out-String }
$result | Should Match "array\s+{0, 1, 2, 3...}"
} # Pending on issue#888
It "Format-Table with Zero Count should work" -Pending {
It "Format-Table with Negative Count should work"{ $FormatEnumerationLimit = 0
$FormatEnumerationLimit = -1 $result = Format-Table -inputobject @{'test'= 1, 2}
$result = Format-Table -inputobject @{'test'= 1, 2} $resultStr = $result|Out-String
$resultStr = $result|Out-String $resultStr | Should Match "test\s+{...}"
$resultStr | Should Match "test\s+{1, 2}" }
}
It "Format-Table with Less Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
#pending on issue#888 $FormatEnumerationLimit = 1
It "Format-Table with Zero Count should work" -pending{ $result = Format-Table -inputobject @{'test'= 1, 2}
$FormatEnumerationLimit = 0 $resultStr = $result|Out-String
$result = Format-Table -inputobject @{'test'= 1, 2} $resultStr | Should Match "test\s+{1...}"
$resultStr = $result|Out-String }
$resultStr | Should Match "test\s+{...}"
} It "Format-Table with More Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$FormatEnumerationLimit = 10
It "Format-Table with Less Count should work"{ $result = Format-Table -inputobject @{'test'= 1, 2}
$FormatEnumerationLimit = 1 $resultStr = $result|Out-String
$result = Format-Table -inputobject @{'test'= 1, 2} $resultStr | Should Match "test\s+{1, 2}"
$resultStr = $result|Out-String }
$resultStr | Should Match "test\s+{1...}"
} It "Format-Table with Equal Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$FormatEnumerationLimit = 2
It "Format-Table with More Count should work"{ $result = Format-Table -inputobject @{'test'= 1, 2}
$FormatEnumerationLimit = 10 $resultStr = $result|Out-String
$result = Format-Table -inputobject @{'test'= 1, 2} $resultStr | Should Match "test\s+{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 {
It "Format-Table with Equal Count should work"{ $FormatEnumerationLimit = "abc"
$FormatEnumerationLimit = 2 $result = Format-Table -inputobject @{'test'= 1, 2}
$result = Format-Table -inputobject @{'test'= 1, 2} $resultStr = $result|Out-String
$resultStr = $result|Out-String $resultStr | Should Match "test\s+{1, 2}"
$resultStr | Should Match "test\s+{1, 2}" }
}
# Pending on issue#888
#pending on issue#888 It "Format-Table with Var Deleted should throw Exception" -Pending {
It "Format-Table with Bogus Count should throw Exception" -pending{ $FormatEnumerationLimit = 2
$FormatEnumerationLimit = "abc" Remove-Variable FormatEnumerationLimit
$result = Format-Table -inputobject @{'test'= 1, 2} $result = Format-Table -inputobject @{'test'= 1, 2}
$resultStr = $result|Out-String $resultStr = $result|Out-String
$resultStr | Should Match "test\s+{1, 2}" $resultStr | Should Match "test\s+{1, 2}"
} }
#pending on issue#888 It "Format-Table with new line should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
It "Format-Table with Var Deleted should throw Exception" -pending{ $info = @{}
$FormatEnumerationLimit = 2 $info.name = "1\n2"
Remove-Variable FormatEnumerationLimit $result = $info|Format-Table|Out-String
$result = Format-Table -inputobject @{'test'= 1, 2} $result | Should Match "name\s+1.+2"
$resultStr = $result|Out-String }
$resultStr | Should Match "test\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")
It "Format-Table with new line should work"{ $IP2 = [System.Net.IPAddress]::Parse("4fde:0000:0000:0002:0022:f376:255.59.171.63")
$info = @{} $IPs = New-Object System.Collections.ArrayList
$info.name = "1\n2" $IPs.Add($IP1)
$result = $info|Format-Table|Out-String $IPs.Add($IP2)
$result | Should Match "name\s+1.+2" $info = @{}
} $info.test = $IPs
$result = $info|Format-Table|Out-String
It "Format-Table with ExposeBug920454 should work"{ $result | Should Match "test\s+{1.1.1.1, 4fde::2:22:f376:ff3b:ab3f}"
$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 It "Format-Table with Autosize should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$IPs.Add($IP1) $IP1 = [PSCustomObject]@{'name'='Bob';'size'=1234;'booleanValue'=$true;}
$IPs.Add($IP2) $IP2 = [PSCustomObject]@{'name'='Jim';'size'=5678;'booleanValue'=$false;}
$info = @{} $IPs = New-Object System.Collections.ArrayList
$info.test = $IPs $IPs.Add($IP1)
$result = $info|Format-Table|Out-String $IPs.Add($IP2)
$result | Should Match "test\s+{1.1.1.1, 4fde::2:22:f376:ff3b:ab3f}" $result = $IPs|Format-Table -Autosize|Out-String
} $result | Should Match "name size booleanValue"
$result | Should Match "---- ---- ------------"
It "Format-Table with Autosize should work"{ $result | Should Match "Bob\s+1234\s+True"
$IP1 = [PSCustomObject]@{'name'='Bob';'size'=1234;'booleanValue'=$true;} $result | Should Match "Jim\s+5678\s+False"
$IP2 = [PSCustomObject]@{'name'='Jim';'size'=5678;'booleanValue'=$false;} }
$IPs = New-Object System.Collections.ArrayList
$IPs.Add($IP1) It "Format-Table with No Objects for End-To-End should work"{
$IPs.Add($IP2) $p = @{}
$result = $IPs|Format-Table -Autosize|Out-String $result = $p|Format-Table -Property "foo","bar"|Out-String
$result | Should Match "name size booleanValue" $result | Should BeNullOrEmpty
$result | Should Match "---- ---- ------------" }
$result | Should Match "Bob\s+1234\s+True"
$result | Should Match "Jim\s+5678\s+False" It "Format-Table with Null Objects for End-To-End should work"{
} $p = $null
$result = $p|Format-Table -Property "foo","bar"|Out-String
It "Format-Table with No Objects for End-To-End should work"{ $result | Should BeNullOrEmpty
$p = @{} }
$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"
It "Format-Table with Null Objects for End-To-End should work"{ $result = $p|Format-Table -Property "foo","bar"|Out-String
$p = $null $result | Should BeNullOrEmpty
$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{
#pending on issue#900 $p = "Line1\nLine2"
It "Format-Table with single line string for End-To-End should work" -pending{ $result = $p|Format-Table -Property "foo","bar"|Out-String
$p = "single line string" $result | Should BeNullOrEmpty
$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{
#pending on issue#900 $p = "Line1","Line2"
It "Format-Table with multiple line string for End-To-End should work" -pending{ $result = $p|Format-Table -Property "foo","bar"|Out-String
$p = "Line1\nLine2" $result | Should BeNullOrEmpty
$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{
#pending on issue#900 $p = "Line1","Line2"
It "Format-Table with string sequence for End-To-End should work" -pending{ $result = $p|Format-Table -Property "foo","bar"|Out-String
$p = "Line1","Line2" $result | Should BeNullOrEmpty
$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}"
#pending on issue#900 $eto = New-Object MyDayOfWeek
It "Format-Table with string sequence for End-To-End should work" -pending{ $info = @{}
$p = "Line1","Line2" $info.intArray = 1,2,3,4
$result = $p|Format-Table -Property "foo","bar"|Out-String $info.arrayList = "string1","string2"
$result | Should BeNullOrEmpty $info.enumerable = [MyDayOfWeek]$eto
} $info.enumerableTestObject = $eto
$result = $info|Format-Table|Out-String
It "Format-Table with complex object for End-To-End should work"{ $result | Should Match "intArray\s+{1, 2, 3, 4}"
Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}" $result | Should Match "arrayList\s+{string1, string2}"
$eto = New-Object MyDayOfWeek $result | Should Match "enumerable\s+Sun"
$info = @{} $result | Should Match "enumerableTestObject\s+Sun"
$info.intArray = 1,2,3,4 }
$info.arrayList = "string1","string2"
$info.enumerable = [MyDayOfWeek]$eto It "Format-Table with Expand Enumerable should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
$info.enumerableTestObject = $eto $obj1 = "x 0","y 0"
$result = $info|Format-Table|Out-String $obj2 = "x 1","y 1"
$result | Should Match "intArray\s+{1, 2, 3, 4}" $objs = New-Object System.Collections.ArrayList
$result | Should Match "arrayList\s+{string1, string2}" $objs.Add($obj1)
$result | Should Match "enumerable\s+Sun" $objs.Add($obj2)
$result | Should Match "enumerableTestObject\s+Sun" $mo = [PSCustomObject]@{name = "this is name";sub = $objs}
} $result1 = $mo|Format-Table -Expand CoreOnly|Out-String
$result1 | Should Match "name\s+sub"
It "Format-Table with Expand Enumerable should work"{ $result1 | Should Match "this is name"
$obj1 = "x 0","y 0"
$obj2 = "x 1","y 1" $result2 = $mo|Format-Table -Expand EnumOnly|Out-String
$objs = New-Object System.Collections.ArrayList $result2 | Should Match "name\s+sub"
$objs.Add($obj1) $result2 | Should Match "this is name\s+{x 0 y 0, x 1 y 1}"
$objs.Add($obj2)
$mo = [PSCustomObject]@{name = "this is name";sub = $objs} $result3 = $mo|Format-Table -Expand Both|Out-String
$result1 = $mo|Format-Table -Expand CoreOnly|Out-String $result3 | Should Match "name\s+sub"
$result1 | Should Match "name\s+sub" $result3 | Should Match "this is name\s+{x 0 y 0, x 1 y 1}"
$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}"
}
}

View file

@ -40,7 +40,7 @@ Describe "Format-Wide" {
} }
Describe "Format-Wide DRT basic functionality" -Tags DRT{ 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) $al = (0..255)
$info = @{} $info = @{}
$info.array = $al $info.array = $al
@ -80,7 +80,7 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{
$result | Should Match "Line2" $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}" Add-Type -TypeDefinition "public enum MyDayOfWeek{Sun,Mon,Tue,Wed,Thr,Fri,Sat}"
$eto = New-Object MyDayOfWeek $eto = New-Object MyDayOfWeek
$info = @{} $info = @{}
@ -94,4 +94,4 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{
$result | Should Match "enumerable" $result | Should Match "enumerable"
$result | Should Match "enumerableTestObject" $result | Should Match "enumerableTestObject"
} }
} }

View file

@ -12,7 +12,7 @@ Describe "Get-Date DRT Unit Tests" -Tags DRT {
$result.Millisecond | Should be 200 $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 = Get-date -Date:"Jan 1, 2020" -DisplayHint Date | Out-String
$d.Trim() | Should be "Wednesday, January 1, 2020" $d.Trim() | Should be "Wednesday, January 1, 2020"
} }

View file

@ -52,7 +52,7 @@ Describe "Out-File" {
{ Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw { 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 Out-File -FilePath $testfile -InputObject $inObject
@ -67,7 +67,7 @@ Describe "Out-File" {
$actual[3] | Should Match "some test text" $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 } | Should Not Throw
{ Out-File -FilePath $testfile -InputObject $inObject -Append } | 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 # create a read-only text file
{ Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw { Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw
Set-ItemProperty -Path $testfile -Name IsReadOnly -Value $true Set-ItemProperty -Path $testfile -Name IsReadOnly -Value $true

View file

@ -1,6 +1,6 @@
Describe "Out-String DRT Unit Tests" -Tags DRT{ 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 = new-object psobject | add-member -passthru noteproperty 'name with square brackets: [0]' 'myvalue' | out-string
$results.Length | Should BeGreaterThan 1 $results.Length | Should BeGreaterThan 1
$results.GetType() | Should Be string $results.GetType() | Should Be string

View file

@ -208,7 +208,7 @@ Describe "Set-Variable" {
$testVar | Should Be $testValue $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 $in = Set-Variable -Name testVar -Value "test" -Description "test description" -PassThru
$output = $in | Format-List -Property Description | Out-String $output = $in | Format-List -Property Description | Out-String

View file

@ -5,67 +5,67 @@ Describe "Stream writer tests" {
# that would normally # that would normally
function Write-Messages function Write-Messages
{ {
[CmdletBinding()] [CmdletBinding()]
param() param()
If ($PSBoundParameters['Debug']) { $DebugPreference = 'Continue' } If ($PSBoundParameters['Debug']) { $DebugPreference = 'Continue' }
Write-Verbose "Verbose message" Write-Verbose "Verbose message"
Write-Debug "Debug message" Write-Debug "Debug message"
} }
function Get-OutputResults function Get-OutputResults
{ {
# Get the contents of the targetfile. # Get the contents of the targetfile.
# Make the array a string for less brittle testing # Make the array a string for less brittle testing
$output = $(Get-Content $args[0]) $output = $(Get-Content $args[0])
[String]::Join([Environment]::NewLine, $output ) [String]::Join([Environment]::NewLine, $output )
return $output return $output
} }
Context "Redirect Stream Tests" { 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 } AfterEach { Remove-Item $targetfile }
It "Should write warnings to the warning stream" { It "Should write warnings to the warning stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
Write-Warning "Test Warning" 3>&1 > $targetfile 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" { It "Should write error messages to the error stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
Write-Error "Testing Error" 2>&1 > $targetfile Write-Error "Testing Error" 2>&1 > $targetfile
$result = Get-OutputResults $targetfile $result = Get-OutputResults $targetfile
# The contents of the error stream should contain the expected text # The contents of the error stream should contain the expected text
$result -match ": Testing Error" | Should Be $true $result -match ": Testing Error" | Should Be $true
} }
It "Should write debug messages to the debug stream" { It "Should write debug messages to the debug stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
Write-Messages -Debug -EA SilentlyContinue 5>&1 > $targetfile 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 # The contents of the debug stream should contain the expected text
$result -match "Debug Message" | Should Be $true $result -match "Debug Message" | Should Be $true
} }
It "Should write messages to the verbose stream" { It "Should write messages to the verbose stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
Write-Messages -Verbose 4>&1 > $targetfile 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 # The contents of the debug stream should contain the expected text
$result -match "Verbose Message" | Should Be $true $result -match "Verbose Message" | Should Be $true
} }
} }
Context "Error automatic variable" { Context "Error automatic variable" {
It "Should write error messages to the `$Error automatic variable" { It "Should write error messages to the `$Error automatic variable" {
Write-Error "Test Error Message" -ErrorAction SilentlyContinue Write-Error "Test Error Message" -ErrorAction SilentlyContinue
$Error[0] | Should Match "Test Error Message" $Error[0] | Should Match "Test Error Message"
} }
} }
} }