Skip to content

Instantly share code, notes, and snippets.

@ninmonkey
Created July 13, 2020 18:12
Show Gist options
  • Save ninmonkey/2ae7e048294a612608f16158a1d0fb89 to your computer and use it in GitHub Desktop.
Save ninmonkey/2ae7e048294a612608f16158a1d0fb89 to your computer and use it in GitHub Desktop.
Test VsCode breakpoints in powershell
# [test]: only breakpoint in a pipe, not on first statement
Get-PSReadLineKeyHandler -bound -unbound # yes
| ? Group -eq Basic # no
| Join-String -seperator ', ' -property Key # no
| Out-Null
# [test] escaped-newline, on the first expression in a pipe # no
# <<next>> line is # yes
Get-PSReadLineKeyHandler -bound -unbound `
| Where-Object Group -EQ Basic | Out-Null
# [test] escaped-newline, *Not* on the first expression in a pipe # no
# <<next>> line is # yes
# then the rest of the pipe are # no
Get-PSReadLineKeyHandler -bound -unbound `
| Where-Object Group -EQ Basic `
| Join-String -seperator ', ' -Property Key `
| Out-Null
echo 'bound' # yes
if($true) { # yes
Get-PSReadLineKeyHandler -Bound | ? Group -eq Basic # yes
| ft Group, Key, Function, Description # no (because 23 exists, otherwise yes)
| rg '$|enter|line|insert' | Out-Null # no (because 23 exists, otherwise yes)
} # no
if($true) { # yes
echo 'unbound' # yes
Get-PSReadLineKeyHandler -unbound | ? Group -eq Basic # yes
| ft Group, Key, Function, Description
| rg '$|enter|line|insert' | Out-Null
# [test] iterated block, on an empty statement
0..4 | ForEach-Object { # yes
# no
} # yes (n-times)
}
if ($true) { # yes
# [test] no-op, but still an executed block # no
# [test] non-comment emtpy line is <<next>>: # no
} # no
if ($true) { # yes
$actualOp = 10 + 10 # yes
} # no
if ($true) { # yes
$actualOp = 10 + 10
# after op, the only breakpoing in a func # no
} # no
hr # yes
Get-PSReadLineKeyHandler -bound -unbound | Where-Object Group -eq 'basic'#yes
1 + 3 # no
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment