From 679702ba05ac797e075867b792502ad72103f868 Mon Sep 17 00:00:00 2001 From: xtqqczze <45661989+xtqqczze@users.noreply.github.com> Date: Mon, 13 Jan 2020 19:21:25 +0000 Subject: [PATCH] Correct case of $PSDefaultParameterValues special variable --- .../Language/Parser/RedirectionOperator.Tests.ps1 | 10 +++++----- .../Clear-EventLog.Tests.ps1 | 2 +- .../Clipboard.Tests.ps1 | 2 +- .../Get-EventLog.Tests.ps1 | 2 +- .../New-EventLog.Tests.ps1 | 2 +- .../Microsoft.PowerShell.Management/Registry.Tests.ps1 | 2 +- .../Remove-EventLog.Tests.ps1 | 2 +- .../Microsoft.PowerShell.Management/TimeZone.Tests.ps1 | 4 ++-- .../Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 | 4 ++-- .../FileCatalog.Tests.ps1 | 2 +- .../Microsoft.PowerShell.Utility/New-Object.Tests.ps1 | 2 +- test/powershell/engine/COM/COM.Basic.Tests.ps1 | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/powershell/Language/Parser/RedirectionOperator.Tests.ps1 b/test/powershell/Language/Parser/RedirectionOperator.Tests.ps1 index be81c381cd..2702aaeb99 100644 --- a/test/powershell/Language/Parser/RedirectionOperator.Tests.ps1 +++ b/test/powershell/Language/Parser/RedirectionOperator.Tests.ps1 @@ -14,8 +14,8 @@ Describe "Redirection operator now supports encoding changes" -Tags "CI" { # If Out-File -Encoding happens to have a default, be sure to # save it away $SavedValue = $null - $oldDefaultParameterValues = $psDefaultParameterValues.Clone() - $psDefaultParameterValues = @{} + $oldDefaultParameterValues = $PSDefaultParameterValues.Clone() + $PSDefaultParameterValues = @{} } AfterAll { # be sure to tidy up afterwards @@ -23,11 +23,11 @@ Describe "Redirection operator now supports encoding changes" -Tags "CI" { } BeforeEach { # start each test with a clean plate! - $psdefaultParameterValues.Remove("Out-File:Encoding") + $PSDefaultParameterValues.Remove("Out-File:Encoding") } AfterEach { # end each test with a clean plate! - $psdefaultParameterValues.Remove("Out-File:Encoding") + $PSDefaultParameterValues.Remove("Out-File:Encoding") } It "If encoding is unset, redirection should be UTF8 without bom" { @@ -70,7 +70,7 @@ Describe "Redirection operator now supports encoding changes" -Tags "CI" { $TXT = $enc.GetBytes($asciiString) $CR = $enc.GetBytes($asciiCR) $expectedBytes = .{ $BOM; $TXT; $CR } - $psdefaultparameterValues["Out-File:Encoding"] = "$encoding" + $PSDefaultParameterValues["Out-File:Encoding"] = "$encoding" $asciiString > TESTDRIVE:/file.txt $observedBytes = Get-Content -AsByteStream TESTDRIVE:/file.txt # THE TEST diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 index 28a9e374f0..860025beac 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Clear-EventLog.Tests.ps1 @@ -3,7 +3,7 @@ Describe "Clear-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = !$IsWindows -or $IsCoreCLR } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Clipboard.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Clipboard.Tests.ps1 index 42b1d76cc3..c6d878fd4b 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Clipboard.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Clipboard.Tests.ps1 @@ -8,7 +8,7 @@ Describe 'Clipboard cmdlet tests' -Tag CI { Context 'Text' { BeforeAll { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = ($IsWindows -and $env:PROCESSOR_ARCHITECTURE.Contains("arm")) -or ($IsLinux -and $xclip -eq $null) } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 index d69986c141..c8eb9642dd 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Get-EventLog.Tests.ps1 @@ -3,7 +3,7 @@ Describe "Get-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = !$IsWindows -or $IsCoreCLR } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 index c0af78122c..2b9da09502 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/New-EventLog.Tests.ps1 @@ -3,7 +3,7 @@ Describe "New-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $IsNotSkipped = ($IsWindows -and !$IsCoreCLR) $PSDefaultParameterValues["it:skip"] = !$IsNotSkipped } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1 index 1e3a141a1b..fdbdadd986 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Registry.Tests.ps1 @@ -2,7 +2,7 @@ # Licensed under the MIT License. try { #skip all tests on non-windows platform - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = !$IsWindows Describe "Basic Registry Provider Tests" -Tags @("CI", "RequireAdminOnWindows") { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 index 92ef62f931..c9bbf5a72f 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/Remove-EventLog.Tests.ps1 @@ -3,7 +3,7 @@ Describe "New-EventLog cmdlet tests" -Tags @('CI', 'RequireAdminOnWindows') { BeforeAll { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $IsNotSkipped = ($IsWindows -and !$IsCoreCLR) $PSDefaultParameterValues["it:skip"] = !$IsNotSkipped } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Management/TimeZone.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Management/TimeZone.Tests.ps1 index 0029dc56bf..cc1652ecd0 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Management/TimeZone.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Management/TimeZone.Tests.ps1 @@ -30,7 +30,7 @@ Describe "Get-Timezone test cases" -Tags "CI" { BeforeAll { $TimeZonesAvailable = [System.TimeZoneInfo]::GetSystemTimeZones() - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = ($TimeZonesAvailable.Count -eq 0) } @@ -127,7 +127,7 @@ Describe "Get-Timezone test cases" -Tags "CI" { } try { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = !$IsWindows Describe "Set-Timezone test case: call by single Id" -Tags @('CI', 'RequireAdminOnWindows') { diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 index 7dc805be35..62dc82c0cd 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/CmsMessage.Tests.ps1 @@ -86,8 +86,8 @@ Describe "CmsMessage cmdlets thorough tests" -Tags "Feature" { else { # Skip for non-Windows platforms - $defaultParamValues = $PSdefaultParameterValues.Clone() - $PSdefaultParameterValues = @{ "it:skip" = $true } + $defaultParamValues = $PSDefaultParameterValues.Clone() + $PSDefaultParameterValues = @{ "it:skip" = $true } } } diff --git a/test/powershell/Modules/Microsoft.PowerShell.Security/FileCatalog.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Security/FileCatalog.Tests.ps1 index b86caafe64..6911532ac9 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Security/FileCatalog.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Security/FileCatalog.Tests.ps1 @@ -5,7 +5,7 @@ try { #skip all tests on non-windows platform - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = !$IsWindows $script:catalogPath = "" diff --git a/test/powershell/Modules/Microsoft.PowerShell.Utility/New-Object.Tests.ps1 b/test/powershell/Modules/Microsoft.PowerShell.Utility/New-Object.Tests.ps1 index a66854d071..48e7d40c54 100644 --- a/test/powershell/Modules/Microsoft.PowerShell.Utility/New-Object.Tests.ps1 +++ b/test/powershell/Modules/Microsoft.PowerShell.Utility/New-Object.Tests.ps1 @@ -133,7 +133,7 @@ Describe "New-Object DRT basic functionality" -Tags "CI" { try { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = ![System.Management.Automation.Platform]::IsWindowsDesktop Describe "New-Object COM functionality" -Tags "CI" { diff --git a/test/powershell/engine/COM/COM.Basic.Tests.ps1 b/test/powershell/engine/COM/COM.Basic.Tests.ps1 index 832b95c53e..7b1599a5d9 100644 --- a/test/powershell/engine/COM/COM.Basic.Tests.ps1 +++ b/test/powershell/engine/COM/COM.Basic.Tests.ps1 @@ -2,7 +2,7 @@ # Licensed under the MIT License. try { - $defaultParamValues = $PSdefaultParameterValues.Clone() + $defaultParamValues = $PSDefaultParameterValues.Clone() $PSDefaultParameterValues["it:skip"] = ![System.Management.Automation.Platform]::IsWindowsDesktop Describe 'Basic COM Tests' -Tags "CI" {