mirror of
https://github.com/PowerShell/PowerShell.git
synced 2024-11-26 19:34:22 +08:00
Support PSObject wrapped values in ArgumentToEncodingTransformationAttribute (#24555)
This commit is contained in:
parent
31b70ecd9f
commit
ba238808fb
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user