mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Re-enable tests on OS X
This commit is contained in:
@@ -21,11 +21,7 @@ Describe "Configuration file locations" {
|
||||
$expectedReadline = [IO.Path]::Combine($env:HOME, ".local", "share", "powershell", "PSReadLine", "ConsoleHost_history.txt")
|
||||
}
|
||||
|
||||
if ($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
$ItArgs = @{ pending = $true }
|
||||
} else {
|
||||
$ItArgs = @{}
|
||||
}
|
||||
$ItArgs = @{}
|
||||
}
|
||||
|
||||
BeforeEach {
|
||||
@@ -65,8 +61,6 @@ Describe "Configuration file locations" {
|
||||
# Using It @ItArgs, we automatically skip on Windows for all these tests
|
||||
if ($IsWindows) {
|
||||
$ItArgs = @{ skip = $true }
|
||||
} elseif ($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
$ItArgs = @{ pending = $true }
|
||||
} else {
|
||||
$ItArgs = @{}
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ Describe "ConsoleHost unit tests" -Tag 'Slow' {
|
||||
$powershell = Join-Path -Path $PsHome -ChildPath "powershell"
|
||||
|
||||
Context "CommandLine" {
|
||||
It "simple -args" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "simple -args" {
|
||||
& $powershell -noprofile { $args[0] } -args "hello world" | Should Be "hello world"
|
||||
}
|
||||
|
||||
It "array -args" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "array -args" {
|
||||
& $powershell -noprofile { $args[0] } -args 1,(2,3) | Should Be 1
|
||||
(& $powershell -noprofile { $args[1] } -args 1,(2,3))[1] | Should Be 3
|
||||
}
|
||||
@@ -38,7 +38,7 @@ Describe "ConsoleHost unit tests" -Tag 'Slow' {
|
||||
$p | & $powershell -noprofile -inputFormat xml { $input | Foreach-Object {$a = 0} { $a += $_.X + $_.Y } { $a } } | Should Be 30
|
||||
}
|
||||
|
||||
It "text input" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "text input" {
|
||||
# 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"
|
||||
}
|
||||
@@ -48,7 +48,7 @@ Describe "ConsoleHost unit tests" -Tag 'Slow' {
|
||||
& $powershell -noprofile -outputFormat xml { [PSCustomObject]@{X=10;Y=20} } | Foreach-Object {$a = 0} { $a += $_.X + $_.Y } { $a } | Should Be 30
|
||||
}
|
||||
|
||||
It "text output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "text output" {
|
||||
# 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"
|
||||
}
|
||||
@@ -85,7 +85,7 @@ Describe "ConsoleHost unit tests" -Tag 'Slow' {
|
||||
}
|
||||
}
|
||||
|
||||
It "Simple redirected output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Simple redirected output" {
|
||||
$si = NewProcessStartInfo "-noprofile 1+1"
|
||||
$process = RunPowerShell $si
|
||||
$process.StandardOutput.ReadToEnd() | Should Be 2
|
||||
|
||||
@@ -58,7 +58,7 @@ Describe "Format-Custom DRT basic functionality" -Tags DRT{
|
||||
}
|
||||
"@
|
||||
|
||||
It "Format-Custom with subobject should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Custom with subobject should work" {
|
||||
$expectResult1 = "this is the name"
|
||||
$expectResult2 = "this is the name of the sub object"
|
||||
$testObject = @{}
|
||||
@@ -74,7 +74,7 @@ Describe "Format-Custom DRT basic functionality" -Tags DRT{
|
||||
$result | Should Match "two"
|
||||
}
|
||||
|
||||
It "Format-Custom with Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Custom with Tree Object should work" {
|
||||
$expectedResult=@"
|
||||
class MyContainer1
|
||||
{
|
||||
@@ -203,7 +203,7 @@ class MyContainer1
|
||||
$result | Should Be $expectedResult
|
||||
}
|
||||
|
||||
It "Format-Custom with Empty Data Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Custom with Empty Data Tree Object should work" {
|
||||
$expectedResult=@"
|
||||
class MyContainer1
|
||||
{
|
||||
@@ -225,7 +225,7 @@ class MyContainer1
|
||||
$result | Should Be $expectedResult
|
||||
}
|
||||
|
||||
It "Format-Custom with Back Pointers Tree Object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Custom with Back Pointers Tree Object should work" {
|
||||
$expectedResult=@"
|
||||
class MyContainer1
|
||||
{
|
||||
@@ -268,7 +268,7 @@ class MyContainer1
|
||||
$result | Should Be $expectedResult
|
||||
}
|
||||
|
||||
It "Format-Custom with Leaf Only Data should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Custom with Leaf Only Data should work" {
|
||||
$expectedResult=@"
|
||||
class MyLeaf1
|
||||
{
|
||||
|
||||
@@ -20,7 +20,7 @@ Describe "Format-List" {
|
||||
$actual | Should Be $expected
|
||||
}
|
||||
|
||||
It "Should produce the expected output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should produce the expected output" {
|
||||
$expected = "${nl}${nl}testName : testValue${nl}${nl}${nl}${nl}"
|
||||
$in = New-Object PSObject
|
||||
Add-Member -InputObject $in -MemberType NoteProperty -Name testName -Value testValue
|
||||
@@ -68,7 +68,7 @@ Describe "Format-List" {
|
||||
}
|
||||
|
||||
Describe "Format-List DRT basic functionality" -Tags DRT{
|
||||
It "Format-List with array should work"-Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-List with array should work" {
|
||||
$al = (0..255)
|
||||
$info = @{}
|
||||
$info.array = $al
|
||||
@@ -106,7 +106,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{
|
||||
$result.Trim() | Should BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Format-List with complex object for End-To-End should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
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 = [MyDayOfWeek]::New()
|
||||
$info = @{}
|
||||
@@ -125,7 +125,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{
|
||||
$result | Should Match "Value : {1, 2, 3, 4}"
|
||||
}
|
||||
|
||||
It "Format-List with multiple same class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){
|
||||
It "Format-List with multiple same class object should work"{
|
||||
Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}"
|
||||
$testobjects = [TestClass]::New('name1',1),[TestClass]::New('name2',2),[TestClass]::New('name3',3)
|
||||
$result = $testobjects|Format-List|Out-String
|
||||
@@ -137,7 +137,7 @@ Describe "Format-List DRT basic functionality" -Tags DRT{
|
||||
$result | Should Match "Length : 3"
|
||||
}
|
||||
|
||||
It "Format-List with multiple different class object should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){
|
||||
It "Format-List with multiple different class object should work"{
|
||||
Add-Type -TypeDefinition "public class TestClass{public TestClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;}"
|
||||
Add-Type -TypeDefinition "public class TestClass2{public TestClass2(string name,string value,int length){Name = name;Value = value; Length = length;}public string Name;public string Value;public int Length;}"
|
||||
$testobjects = [TestClass]::New('name1',1),[TestClass2]::New('name2',"value2",2),[TestClass]::New('name3',3)
|
||||
|
||||
@@ -43,7 +43,7 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
}
|
||||
}
|
||||
|
||||
It "Format-Table with array should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Table with array should work" {
|
||||
$al = (0..255)
|
||||
$info = @{}
|
||||
$info.array = $al
|
||||
@@ -51,7 +51,7 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
$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 Negative Count should work" {
|
||||
$FormatEnumerationLimit = -1
|
||||
$result = Format-Table -inputobject @{'test'= 1, 2}
|
||||
$resultStr = $result|Out-String
|
||||
@@ -66,21 +66,21 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
$resultStr | Should Match "test\s+{...}"
|
||||
}
|
||||
|
||||
It "Format-Table with Less Count should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Table with Equal Count should work" {
|
||||
$FormatEnumerationLimit = 2
|
||||
$result = Format-Table -inputobject @{'test'= 1, 2}
|
||||
$resultStr = $result|Out-String
|
||||
@@ -104,14 +104,14 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
$resultStr | Should Match "test\s+{1, 2}"
|
||||
}
|
||||
|
||||
It "Format-Table with new line should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
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
|
||||
@@ -123,7 +123,7 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
$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") {
|
||||
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
|
||||
@@ -176,7 +176,7 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
$result | Should BeNullOrEmpty
|
||||
}
|
||||
|
||||
It "Format-Table with complex object for End-To-End should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
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 = @{}
|
||||
@@ -191,7 +191,7 @@ Describe "Format-Table DRT Unit Tests" -Tags DRT{
|
||||
$result | Should Match "enumerableTestObject\s+Sun"
|
||||
}
|
||||
|
||||
It "Format-Table with Expand Enumerable should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Table with Expand Enumerable should work" {
|
||||
$obj1 = "x 0","y 0"
|
||||
$obj2 = "x 1","y 1"
|
||||
$objs = New-Object System.Collections.ArrayList
|
||||
|
||||
@@ -40,7 +40,7 @@ Describe "Format-Wide" {
|
||||
}
|
||||
|
||||
Describe "Format-Wide DRT basic functionality" -Tags DRT{
|
||||
It "Format-Wide with array should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Wide with array should work" {
|
||||
$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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Format-Wide 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 = @{}
|
||||
@@ -95,7 +95,7 @@ Describe "Format-Wide DRT basic functionality" -Tags DRT{
|
||||
$result | Should Match "enumerableTestObject"
|
||||
}
|
||||
|
||||
It "Format-Wide with multiple same class object with grouping should work" -Pending:($env:TRAVIS_OS_NAME -eq "osx"){
|
||||
It "Format-Wide with multiple same class object with grouping should work"{
|
||||
Add-Type -TypeDefinition "public class TestGroupingClass{public TestGroupingClass(string name,int length){Name = name;Length = length;}public string Name;public int Length;public string GroupingKey;}"
|
||||
$testobject1 = [TestGroupingClass]::New('name1',1)
|
||||
$testobject1.GroupingKey = "foo"
|
||||
|
||||
@@ -12,7 +12,7 @@ Describe "Get-Date DRT Unit Tests" -Tags DRT {
|
||||
$result.Millisecond | Should be 200
|
||||
}
|
||||
|
||||
It "using -displayhint produces the correct output" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "using -displayhint produces the correct output" {
|
||||
$d = Get-date -Date:"Jan 1, 2020" -DisplayHint Date | Out-String
|
||||
$d.Trim() | Should be "Wednesday, January 1, 2020"
|
||||
}
|
||||
|
||||
@@ -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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should not overwrite when the noclobber switch is used" {
|
||||
|
||||
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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should Append a new line when the append switch is used" {
|
||||
{ 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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should allow the cmdlet to overwrite an existing read-only file" {
|
||||
# create a read-only text file
|
||||
{ Out-File -FilePath $testfile -InputObject $inObject } | Should Not Throw
|
||||
Set-ItemProperty -Path $testfile -Name IsReadOnly -Value $true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Describe "Out-String DRT Unit Tests" -Tags DRT{
|
||||
|
||||
It "check display of properties with names containing wildcard characters" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "check display of properties with names containing wildcard characters" {
|
||||
$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
|
||||
|
||||
@@ -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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should be able to pipe object properties to output using the PassThru switch" {
|
||||
$in = Set-Variable -Name testVar -Value "test" -Description "test description" -PassThru
|
||||
|
||||
$output = $in | Format-List -Property Description | Out-String
|
||||
|
||||
@@ -28,13 +28,13 @@ Describe "Stream writer tests" {
|
||||
# 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" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should write warnings to the warning stream" {
|
||||
Write-Warning "Test Warning" 3>&1 > $targetfile
|
||||
|
||||
Get-Content $targetfile | Should Be "Test Warning"
|
||||
}
|
||||
|
||||
It "Should write error messages to the error stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should write error messages to the error stream" {
|
||||
Write-Error "Testing Error" 2>&1 > $targetfile
|
||||
|
||||
$result = Get-OutputResults $targetfile
|
||||
@@ -42,7 +42,7 @@ Describe "Stream writer tests" {
|
||||
$result -match ": Testing Error" | Should Be $true
|
||||
}
|
||||
|
||||
It "Should write debug messages to the debug stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should write debug messages to the debug stream" {
|
||||
Write-Messages -Debug -EA SilentlyContinue 5>&1 > $targetfile
|
||||
|
||||
$result = Get-OutputResults $targetfile
|
||||
@@ -51,7 +51,7 @@ Describe "Stream writer tests" {
|
||||
$result -match "Debug Message" | Should Be $true
|
||||
}
|
||||
|
||||
It "Should write messages to the verbose stream" -Pending:($env:TRAVIS_OS_NAME -eq "osx") {
|
||||
It "Should write messages to the verbose stream" {
|
||||
Write-Messages -Verbose 4>&1 > $targetfile
|
||||
|
||||
$result = Get-OutputResults $targetfile
|
||||
|
||||
Reference in New Issue
Block a user