mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Add Statement property to $MyInvocation (#19027)
This commit is contained in:
1 parent
6dfba03aa3
commit
1925cf67af
2 files changed
+31
No files matched your search
@@ -23,6 +23,25 @@ Describe 'Testing of MyInvocation' -Tags "CI" {
|
||||
{ & myfilter } | Should -Not -Throw
|
||||
}
|
||||
|
||||
Context 'MyInvocation works with multi-line invocations' {
|
||||
It 'MyInvocation.Statement works in & Script block' {
|
||||
$a = & {
|
||||
$MyInvocation.Statement
|
||||
}
|
||||
$a.IndexOf('& {
|
||||
$MyInvocation.Statement
|
||||
}') |Should -BeGreaterThan -1
|
||||
}
|
||||
It 'MyInvocation.Statement works in dot sourced Script block' {
|
||||
$a = . {
|
||||
$MyInvocation.Statement
|
||||
}
|
||||
$a.IndexOf('. {
|
||||
$MyInvocation.Statement
|
||||
}') |Should -BeGreaterThan -1
|
||||
}
|
||||
}
|
||||
|
||||
Context 'MyInvocation works in Script block' {
|
||||
|
||||
It 'MyInvocation works in dot sourced Script block' {
|
||||
|
||||
Reference in new issue
Block a user