Skip to content

$input type in advanced functions #1563

@vors

Description

@vors

We have a test for $input type behavior in advanced functions (functions that are cmdlets).

It '$input Type should be enumerator' {
        function from_begin { [cmdletbinding()]param() begin { Write-Output -NoEnumerate $input } }
        function from_process { [cmdletbinding()]param() process { Write-Output -NoEnumerate $input } }
        function from_end { [cmdletbinding()]param() end { Write-Output -NoEnumerate $input } }

        (from_begin) -is [System.Collections.IEnumerator] | Should Be $true
        (from_process) -is [System.Collections.IEnumerator] | Should Be $true
        (from_end) -is [System.Collections.IEnumerator] | Should Be $true
    } 

It '$input Type should be enumerator' {

This tests works fine in PS v2. Since then, the behavior changed to this

        (from_begin) -is [System.Collections.ArrayList] | Should Be $true
        (from_process) -is [System.Collections.ArrayList] | Should Be $true
        (from_end) -is [System.Object[]] | Should Be $true

Which is pretty inconsistent, but exists since v3.

@lzybkr was trying to fix it (back to v2 behavior) and it broke a couple customer scenarios.

Plan: we will gover feedback about this issue and may consider go thru breaking change process.
Meanwhile, I'm marking the test as -Skip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Breaking-Changebreaking change that may affect usersCommittee-ReviewedPS-Committee has reviewed this and made a decisionResolution-By DesignThe reported behavior is by design.WG-Enginecore PowerShell engine, interpreter, and runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions