mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Support PSObject wrapped values in ArgumentToEncodingTransformationAttribute (#24555)
This commit is contained in:
@@ -115,6 +115,8 @@ namespace System.Management.Automation
|
||||
{
|
||||
public override object Transform(EngineIntrinsics engineIntrinsics, object inputData)
|
||||
{
|
||||
inputData = PSObject.Base(inputData);
|
||||
|
||||
switch (inputData)
|
||||
{
|
||||
case string stringName:
|
||||
|
||||
@@ -89,6 +89,8 @@ Describe "File encoding tests" -Tag CI {
|
||||
It "Parameter 'Encoding' should accept '<encoding>'" -TestCases @(
|
||||
@{ encoding = 1251 }
|
||||
@{ encoding = "windows-1251" }
|
||||
# Piping the string creates a PSObject boxed value that we are testing.
|
||||
@{ encoding = ("windows-1251" | Write-Output) }
|
||||
) {
|
||||
param ( $encoding )
|
||||
$testFile = "${TESTDRIVE}/fileEncoding-$($encoding).txt"
|
||||
|
||||
Reference in New Issue
Block a user