diff --git a/test/powershell/ConsoleHost.Tests.ps1 b/test/powershell/ConsoleHost.Tests.ps1 index 69ea6a532..d5f18a07d 100644 --- a/test/powershell/ConsoleHost.Tests.ps1 +++ b/test/powershell/ConsoleHost.Tests.ps1 @@ -142,4 +142,24 @@ Describe "ConsoleHost unit tests" { EnsureChildHasExited $process } } + + Context "Exception handling" { + It "Should handle a CallDepthOverflow" { + # Infinite recursion + function recurse + { + recurse $args + } + + try + { + recurse "args" + Throw "Incorrect exception" + } + catch + { + $_.FullyQualifiedErrorId | Should Be "CallDepthOverflow" + } + } + } }