Skip to content

Is there a better way to do type comparisons? #9

Description

@serialhobbyist

I was trying to test a returned object's type but I couldn't make it work in a good way.

$obj = @()
$obj | should be [Array]

gives

Expected that (actual) () be ([Array]).

I can, of course, do:

$obj -is [Array] | should be $true

but when it's not true I get

Expected that (actual) (False) be (True)

rather than the actual type. Is there a way to write it such that I get the type back when it fails?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions