[release/v7.6] Make some experimental features stable (#26490)

This commit is contained in:
Travis Plunk
2025-11-20 14:57:21 -08:00
committed by GitHub
parent ce725ce207
commit 9532f85fe4
11 changed files with 37 additions and 84 deletions
@@ -127,12 +127,6 @@ Describe "File redirection should have 'DoComplete' called on the underlying pip
Describe "Redirection and Set-Variable -append tests" -tags CI {
Context "variable redirection should work" {
BeforeAll {
if ( $EnabledExperimentalFeatures -contains "PSRedirectToVariable" ) {
$skipTest = $false
}
else {
$skipTest = $true
}
$testCases = @{ Name = "Variable should be created"; scriptBlock = { 1..3>variable:a }; Validation = { ($a -join "") | Should -Be ((1..3) -join "") } },
@{ Name = "variable should be appended"; scriptBlock = {1..3>variable:a; 4..6>>variable:a}; Validation = { ($a -join "") | Should -Be ((1..6) -join "")}},
@{ Name = "variable should maintain type"; scriptBlock = {@{one=1}>variable:a};Validation = {$a | Should -BeOfType [hashtable]}},
@@ -220,7 +214,7 @@ Describe "Redirection and Set-Variable -append tests" -tags CI {
}
It "<name>" -TestCases $testCases -skip:$skipTest {
It "<name>" -TestCases $testCases {
param ( $scriptBlock, $validation )
. $scriptBlock
. $validation
@@ -5,7 +5,6 @@ Describe 'Native Windows tilde expansion tests' -tags "CI" {
BeforeAll {
$originalDefaultParams = $PSDefaultParameterValues.Clone()
$PSDefaultParameterValues["it:skip"] = -Not $IsWindows
$EnabledExperimentalFeatures.Contains('PSNativeWindowsTildeExpansion') | Should -BeTrue
}
AfterAll {
@@ -21,12 +20,13 @@ Describe 'Native Windows tilde expansion tests' -tags "CI" {
cmd /c echo ~/foo | Should -BeExactly "$($ExecutionContext.SessionState.Provider.Get("FileSystem").Home)/foo"
cmd /c echo ~\foo | Should -BeExactly "$($ExecutionContext.SessionState.Provider.Get("FileSystem").Home)\foo"
}
It '~ should not be replaced when quoted' {
cmd /c echo '~' | Should -BeExactly '~'
cmd /c echo "~" | Should -BeExactly '~'
cmd /c echo '~/foo' | Should -BeExactly '~/foo'
cmd /c echo "~/foo" | Should -BeExactly '~/foo'
It '~ should not be replaced when quoted' {
cmd /c echo '~' | Should -BeExactly '~'
cmd /c echo "~" | Should -BeExactly '~'
cmd /c echo '~/foo' | Should -BeExactly '~/foo'
cmd /c echo "~/foo" | Should -BeExactly '~/foo'
cmd /c echo '~\foo' | Should -BeExactly '~\foo'
cmd /c echo "~\foo" | Should -BeExactly '~\foo'
}
cmd /c echo "~\foo" | Should -BeExactly '~\foo'
}
}
@@ -244,44 +244,30 @@ Describe "Set-Variable" -Tags "CI" {
Context "Set-Variable -Append tests" {
BeforeAll {
if (! (Get-ExperimentalFeature PSRedirectToVariable).Enabled) {
$skipTest = $true
}
$testCases = @{ value = 2; Count = 2 },
@{ value = @(2,3,4); Count = 2},
@{ value = "abc",(Get-Process -Id $PID) ; count = 2}
$testCases = @{ value = 2; Count = 2 },
@{ value = @(2,3,4); Count = 2},
@{ value = "abc",(Get-Process -Id $PID) ; count = 2}
}
It "Can append values <value> to a variable" -testCases $testCases {
param ($value, $count)
It "Can append values <value> to a variable" -testCases $testCases {
param ($value, $count)
if ($skipTest) {
Set-ItResult -skip -because "Experimental Feature PSRedirectToVariable not enabled"
return
}
$variableName = "testVar"
Set-Variable -Name $variableName -Value 1
Set-Variable -Name $variableName -Value $value -Append
$variableName = "testVar"
Set-Variable -Name $variableName -Value 1
Set-Variable -Name $variableName -Value $value -Append
$observedValues = Get-Variable $variableName -Value
$observedValues = Get-Variable $variableName -Value
$observedValues.Count | Should -Be $count
$observedValues[0] | Should -Be 1
$observedValues.Count | Should -Be $count
$observedValues[0] | Should -Be 1
$observedValues[1] | Should -Be $value
}
$observedValues[1] | Should -Be $value
}
It "Can use set-variable via streaming and append values" {
if ($skipTest) {
Set-ItResult -skip -because "Experimental Feature PSRedirectToVariable not enabled"
return
}
$testVar = 1
4..6 | Set-Variable -Name testVar -Append
$testVar | Should -Be @(1,4,5,6)
}
It "Can use set-variable via streaming and append values" {
$testVar = 1
4..6 | Set-Variable -Name testVar -Append
$testVar | Should -Be @(1,4,5,6)
}
}
}
@@ -337,6 +337,7 @@ Describe "Verify aliases and cmdlets" -Tags "CI" {
"Cmdlet", "Get-PSSessionCapability", "", $($FullCLR -or $CoreWindows ), "", "", "None"
"Cmdlet", "Get-PSSessionConfiguration", "", $($FullCLR -or $CoreWindows ), "", "", "None"
"Cmdlet", "Get-PSSnapin", "", $($FullCLR ), "", "", ""
"Cmdlet", "Get-PSSubsystem", "", $( $CoreWindows -or $CoreUnix), "", "", "None"
"Cmdlet", "Get-Random", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None"
"Cmdlet", "Get-Runspace", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None"
"Cmdlet", "Get-RunspaceDebug", "", $($FullCLR -or $CoreWindows -or $CoreUnix), "", "", "None"
-3
View File
@@ -1,9 +1,6 @@
{
"ExperimentalFeatures": {
"ExpTest.FeatureOne": [ "test/powershell/engine/ExperimentalFeature/ExperimentalFeature.Basic.Tests.ps1" ],
"PSCultureInvariantReplaceOperator": [ "test/powershell/Language/Operators/ReplaceOperator.Tests.ps1" ],
"Microsoft.PowerShell.Utility.PSManageBreakpointsInRunspace": [ "test/powershell/Modules/Microsoft.PowerShell.Utility/RunspaceBreakpointManagement.Tests.ps1" ],
"PSNativeWindowsTildeExpansion": [ "test/powershell/Language/Scripting/NativeExecution/NativeWindowsTildeExpansion.Tests.ps1" ],
"PSSerializeJSONLongEnumAsNumber": [ "test/powershell/Modules/Microsoft.PowerShell.Utility/ConvertTo-Json.PSSerializeJSONLongEnumAsNumber.Tests.ps1" ]
}
}