Skip to content

incorrect assertions in test specs #176

Open
@msftrncs

Description

@msftrncs

This is to point out some incorrect assertions in the spec tests.

3++2
# ^ ^^ constant.numeric.integer.powershell
# ^ keyword.operator.assignment.powershell

The ++ is actually the unary increment operator, and PowerShell will flag this as an error because it cannot be used on a constant.
image

# Commands (Built-in variables)
ls *.ps1 -recurse
# ^ ^ keyword.operator.assignment.powershell

These are not operators in these instances, so even though the grammar scopes them as such, asserting these tests is misleading and will require correcting when the grammar is improved. This is covered in issue #112.

$roman | c:\users\Me\Documents\Programming\F#\test.exe $roman
# ^ punctuation.definition.variable.powershell
# ^ variable.other.readwrite.powershell
# ^ keyword.operator.other.powershell
# ^ punctuation.definition.comment.powershell
# ^ ^ comment.line.powershell

The # is this spec is not a line comment token. Its actually part of an unquoted non-expanding string that describes a function/command name. This is covered in issue #62.

(Example under PR #156)
image

$file = join-path $env:SystemDrive "$([System.io.path]::GetRandomFileName()).ps1"
# <- punctuation.definition.variable.powershell
# ^ support.function.powershell
# ^ support.variable.drive.powershell
# ^ variable.other.readwrite.powershell
# ^ string.quoted.double.powershell punctuation.definition.variable.powershell
# ^ storage.type.powershell

Line 1186 specs the $ as definition.variable. This is covered in issue #132.

(Example under PR #156 I have scoped it as punctuation.section.embedded.begin)
image

This might only be a partial listing. This is some of the specs I am constantly looking at when checking my work. I list these more so that others can avoid needing to question these.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions