From ee582d42d5ae82537efce942a446f6307b568f27 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Thu, 19 May 2016 10:48:02 -0700 Subject: [PATCH] Add regression test for CallDepthOverflow --- test/powershell/ConsoleHost.Tests.ps1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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" + } + } + } }