Skip to content

Commit

Permalink
Fix test failures due to changes in .NET Core and the exclusion of 'C…
Browse files Browse the repository at this point in the history
…ertificate' provider in UNIX PS
  • Loading branch information
daxian-dbw authored and mirichmo committed Oct 14, 2016
1 parent f02b6ef commit 139b399
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 15 deletions.
8 changes: 8 additions & 0 deletions test/powershell/Language/Parser/RedirectionOperator.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ Describe "Redirection operator now supports encoding changes" -Tags "CI" {
$availableEncodings = (get-command out-file).Parameters["Encoding"].Attributes.ValidValues

foreach($encoding in $availableEncodings) {
if ($encoding -eq "default") {
# [System.Text.Encoding]::Default is exposed by 'System.Private.CoreLib.dll' at
# runtime via reflection. However,it isn't exposed in the reference contract of
# 'System.Text.Encoding', and therefore we cannot use 'Encoding.Default' in our
# code. So we need to skip this encoding in the test.
continue
}

# some of the encodings accepted by out-file aren't real,
# and out-file has its own translation, so we'll
# not do that logic here, but simply ignore those encodings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,18 @@ Describe "Get-PSDrive" -Tags "CI" {
}

It "Should return drive info"{
(Get-PSDrive Env).Name | Should Be Env
(Get-PSDrive Cert).Root | Should Be \

if ($IsWindows)
{
(Get-PSDrive C).Provider.Name | Should Be FileSystem
}
else
{
(Get-PSDrive /).Provider.Name | Should Be FileSystem
}
(Get-PSDrive Env).Name | Should Be Env
(Get-PSDrive Alias).Name | Should Be Alias

if ($IsWindows)
{
(Get-PSDrive Cert).Root | Should Be \
(Get-PSDrive C).Provider.Name | Should Be FileSystem
}
else
{
(Get-PSDrive /).Provider.Name | Should Be FileSystem
}
}

It "Should be able to access a drive using the PSProvider switch" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
$testCases += [TestData]::new("PS1", $ps1File, [NullString]::Value)
$testCases += [TestData]::new("Empty string", "", "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ExportAliasCommand")
$testCases += [TestData]::new("Null", [NullString]::Value, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'cert:\alias.ps1', "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'env:\alias.ps1', "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportAliasCommand")
}

$testCases | % {
Expand Down Expand Up @@ -116,7 +116,7 @@
$testCases = @()
$testCases += [TestData]::new("Empty string", "", "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ImportAliasCommand")
$testCases += [TestData]::new("Null", [NullString]::Value, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'cert:\alias.ps1', "NotSupported,Microsoft.PowerShell.Commands.ImportAliasCommand")
$testCases += [TestData]::new("Non filesystem provider", 'env:\alias.ps1', "NotSupported,Microsoft.PowerShell.Commands.ImportAliasCommand")
}

$testCases | % {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
$testData = @()
$testData += [TestData]::new("with path as Null", [NullString]::Value, $gps, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportClixmlCommand")
$testData += [TestData]::new("with path as Empty string", "", $gps, "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ExportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "cert:\", $gps, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "env:\", $gps, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ExportClixmlCommand")
}

AfterEach {
Expand Down Expand Up @@ -132,7 +132,7 @@
$testData = @()
$testData += [TestData]::new("with path as Null", [NullString]::Value, $null, "ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ImportClixmlCommand")
$testData += [TestData]::new("with path as Empty string", "", $null, "ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.ImportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "cert:\", $null, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ImportClixmlCommand")
$testData += [TestData]::new("with path as non filesystem provider", "env:\", $null, "ReadWriteFileNotFileSystemProvider,Microsoft.PowerShell.Commands.ImportClixmlCommand")
}

$testData | % {
Expand Down

0 comments on commit 139b399

Please sign in to comment.