Correct case of $IsWindows special variable

This commit is contained in:
xtqqczze 2020-01-13 19:27:21 +00:00
parent 72d52b7d08
commit 94a73caa41
8 changed files with 14 additions and 14 deletions

View file

@ -183,7 +183,7 @@ function Get-ContainerPowerShellVersion
$runParams = @()
$localVolumeName = $testContext.resolvedTestDrive
$runParams += '--rm'
if($TestContext.Type -ne 'Windows' -and $isWindows)
if($TestContext.Type -ne 'Windows' -and $IsWindows)
{
# use a container volume on windows because host volumes are not automatic
$volumeName = "test-volume-" + (Get-Random -Minimum 100 -Maximum 999)
@ -204,7 +204,7 @@ function Get-ContainerPowerShellVersion
$runParams += ('$PSVersionTable.PSVersion.ToString() | out-string | out-file -encoding ascii -FilePath '+$testContext.containerLogPath)
$null = Invoke-Docker -Command run -Params $runParams -SuppressHostOutput
if($TestContext.Type -ne 'Windows' -and $isWindows)
if($TestContext.Type -ne 'Windows' -and $IsWindows)
{
$null = Invoke-Docker -Command cp -Params "${volumeName}:$($testContext.containerLogPath)", $TestContext.ResolvedLogPath
$null = Invoke-Docker -Command container, rm -Params $volumeName, '--force' -SuppressHostOutput

View file

@ -196,7 +196,7 @@ baz
Set-Content -Path $testPath $testContent
$result = Get-Content @GetContentParams
$result.Length | Should -Be $expectedLength
if ($isWindows) {
if ($IsWindows) {
$result | Should -BeExactly $expectedWindowsContent
} else {
$result | Should -BeExactly $expectedNotWindowsContent

View file

@ -64,7 +64,7 @@ Describe "Test-Connection" -tags "CI" {
{ $result = Test-Connection "fakeHost" -Count 1 -Quiet -ErrorAction Stop } |
Should -Throw -ErrorId "TestConnectionException,Microsoft.PowerShell.Commands.TestConnectionCommand"
# Error code = 11001 - Host not found.
if (!$isWindows) {
if (!$IsWindows) {
$error[0].Exception.InnerException.ErrorCode | Should -Be -131073
} else {
$error[0].Exception.InnerException.ErrorCode | Should -Be 11001
@ -77,7 +77,7 @@ Describe "Test-Connection" -tags "CI" {
$result[0].Address | Should -BeExactly $realAddress
$result[0].Reply.Options.Ttl | Should -BeLessOrEqual 128
if ($isWindows) {
if ($IsWindows) {
$result[0].Reply.Options.DontFragment | Should -BeFalse
}
}
@ -94,7 +94,7 @@ Describe "Test-Connection" -tags "CI" {
$result1.Address | Should -BeExactly $realAddress
$result1.Reply.Options.Ttl | Should -BeLessOrEqual 128
if (!$isWindows) {
if (!$IsWindows) {
$result1.Reply.Options.DontFragment | Should -BeFalse
# Depending on the network configuration any of the following should be returned
$result2.Status | Should -BeIn "TtlExpired", "TimedOut", "Success"
@ -216,7 +216,7 @@ Describe "Test-Connection" -tags "CI" {
$pingResults.Count | Should -BeGreaterThan 4
$pingResults[0].Address | Should -BeExactly $targetAddress
$pingResults.Status | Should -Contain "Success"
if ($isWindows) {
if ($IsWindows) {
$pingResults.Where( { $_.Status -eq 'Success' }, 'Default', 1 ).BufferSize | Should -Be 32
}
}
@ -254,7 +254,7 @@ Describe "Test-Connection" -tags "CI" {
$result[0].Hop | Should -Be 1
$result[0].HopAddress | Should -BeExactly $realAddress
$result[0].Status | Should -BeExactly "Success"
if (!$isWindows) {
if (!$IsWindows) {
$result[0].Reply.Buffer.Count | Should -Match '^0$|^32$'
} else {
$result[0].Reply.Buffer.Count | Should -Be 32

View file

@ -58,7 +58,7 @@ Describe "Start-Transcript, Stop-Transcript tests" -tags "CI" {
It "Should create Transcript file at default path" {
$script = "Start-Transcript"
if ($isWindows) {
if ($IsWindows) {
$defaultTranscriptFilePath = [io.path]::Combine($env:USERPROFILE, "Documents", "PowerShell_transcript*")
} else {
$defaultTranscriptFilePath = [io.path]::Combine($env:HOME, "PowerShell_transcript*")

View file

@ -5,7 +5,7 @@ Describe "TestImplicitRemotingBatching hook should correctly batch simple remote
BeforeAll {
if (! $isWindows) { return }
if (! $IsWindows) { return }
function ThrowSetupError
{
@ -149,7 +149,7 @@ Describe "TestImplicitRemotingBatching hook should correctly batch simple remote
AfterAll {
if (! $isWindows) { return }
if (! $IsWindows) { return }
if ($remoteSession -ne $null) { Remove-PSSession $remoteSession -ErrorAction Ignore }
if ($powershell -ne $null) { $powershell.Dispose() }

View file

@ -205,7 +205,7 @@ Describe "Remoting loopback tests" -Tags @('CI', 'RequireAdminOnWindows') {
AfterAll {
$global:PSDefaultParameterValues = $originalDefaultParameterValues
if($isWindows)
if($IsWindows)
{
Remove-PSSession $disconnectedSession,$closedSession,$openSession -ErrorAction SilentlyContinue
}

View file

@ -8,7 +8,7 @@ Describe "Remote runspace pool should expose commands in endpoint configuration"
BeforeAll {
if ($isWindows -and (Test-CanWriteToPsHome))
if ($IsWindows -and (Test-CanWriteToPsHome))
{
$configName = "restrictedV"
$configPath = Join-Path $TestDrive ($configName + ".pssc")

View file

@ -18,7 +18,7 @@ Import-Module (Join-Path $repoRoot 'build.psm1') -Scope Global
Import-Module (Join-Path $repoRoot 'tools\packaging') -scope Global
# import the windows specific functcion only in Windows PowerShell or on Windows
if($PSVersionTable.PSEdition -eq 'Desktop' -or $isWindows)
if($PSVersionTable.PSEdition -eq 'Desktop' -or $IsWindows)
{
Import-Module (Join-Path $PSScriptRoot 'WindowsCI.psm1') -scope Global
}