-
Notifications
You must be signed in to change notification settings - Fork 234
Add LengthInBufferCells
back to EditorServicesConsolePSHostRawUserInterface
#1606
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Fixes #840 for the preview. |
…Interface` These changes were accidentally forgotten in the rewrite and needed to be added back.
d39f0f7
to
474b850
Compare
Do we have any tests where we have a If yes, then running something like this: [pscustomobject]@{ a = "`e[30mtest`e[0m" } |
Format-Table @{ Width = 4; Expression = 'a' } |
Out-Default and then reading what is sent to |
Any idea how to do this part? I've got a test that starts up everything and runs the command as if via |
Yeah so when it hits the UI it'll have already gone through the formatter. The results are just the raw unformatted objects. For certain things you can also use |
Hm, well this is as far as I got with the test and I think I'm going to postpone getting a test for this so we can just get the fix in: // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System;
using System.Collections.Generic;
using System.Management.Automation;
using System.Threading;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Execution;
using Microsoft.PowerShell.EditorServices.Services.PowerShell.Host;
using Xunit;
namespace Microsoft.PowerShell.EditorServices.Test.Console
{
public class PSHostTests : IDisposable
{
private readonly PsesInternalHost _psesHost;
public PSHostTests()
{
_psesHost = PsesHostFactory.Create(NullLoggerFactory.Instance);
}
public void Dispose()
{
_psesHost.StopAsync().GetAwaiter().GetResult();
}
[Trait("Category", "LengthInBufferCells")]
[Fact]
public void HasLengthInBufferCells()
{
var script = @"[pscustomobject]@{ a = ""`e[30mtest`e[0m"" } | Format-Table @{ Width = 4; Expression = 'a' } | Out-Default";
IReadOnlyList<string> results = _psesHost.InvokePSCommand<string>(
new PSCommand().AddScript(script),
new PowerShellExecutionOptions { WriteInputToHost = true, WriteOutputToHost = true, ThrowOnError = false, InterruptCurrentForeground = true },
CancellationToken.None);
Assert.NotEmpty(results);
}
}
} |
Part of #1677 |
Fixes #1603.
These changes were accidentally forgotten in the rewrite and needed to be added back.
@SeeminglyScience Do you know how we could add a regression test for this?