mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Move Set-StrictMode to outer scriptblock for ErrorView (#11381)
This commit is contained in:
1 parent
04cf068878
commit
edd3e7680c
2 files changed
+20
-1
No files matched your search
@@ -63,4 +63,23 @@ Describe 'Tests for $ErrorView' -Tag CI {
|
||||
$e | Out-String | Should -Not -BeLike '*pester*'
|
||||
}
|
||||
}
|
||||
|
||||
Context 'NormalView tests' {
|
||||
|
||||
It 'Error shows up when using strict mode' {
|
||||
try {
|
||||
$ErrorView = 'NormalView'
|
||||
Set-StrictMode -Version 2
|
||||
throw 'Oops!'
|
||||
}
|
||||
catch {
|
||||
$e = $_ | Out-String
|
||||
}
|
||||
finally {
|
||||
Set-StrictMode -Off
|
||||
}
|
||||
|
||||
$e | Should -BeLike '*Oops!*'
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user