Skip to content

Commit 2648d12

Browse files
committed
Add regression test for throw
1 parent a3fbde3 commit 2648d12

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

test/PowerShellEditorServices.Test/Session/PsesInternalHostTests.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
using System.Threading;
77
using System.Threading.Tasks;
88
using Microsoft.Extensions.Logging.Abstractions;
9-
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host;
109
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Console;
10+
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution;
11+
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host;
1112
using Xunit;
1213

1314
namespace Microsoft.PowerShell.EditorServices.Test.Console
@@ -41,6 +42,19 @@ public async Task CanExecutePSCommand()
4142
Assert.Equal("foo", result[0]);
4243
}
4344

45+
[Fact] // https://github.com/PowerShell/vscode-powershell/issues/3677
46+
public async Task CanHandleThrow()
47+
{
48+
// TODO: Fix this so it doesn't throw!
49+
_ = await Assert.ThrowsAsync<ArgumentOutOfRangeException>(() =>
50+
{
51+
return psesHost.ExecutePSCommandAsync(
52+
new PSCommand().AddScript("throw"),
53+
CancellationToken.None,
54+
new PowerShellExecutionOptions { ThrowOnError = false });
55+
}).ConfigureAwait(true);
56+
}
57+
4458
[Fact]
4559
public async Task CanQueueParallelPSCommands()
4660
{

0 commit comments

Comments
 (0)