提交 4c4135aa 编写于 作者: M Manish Jayaswal

Merge pull request #4504 from ManishJayaswal/fix-4121and4125

Fix #4121,  #4125 and #4277 
......@@ -334,6 +334,15 @@ private void PendSubmissions(IEnumerable<PendingSubmission> inputs)
public void AddInput(string command)
{
// If the language buffer is readonly then input can not be added. Return immediately.
// The language buffer gets marked as readonly in SubmitAsync method when input on the prompt
// gets submitted. So it would be readonly when the user types #reset on the prompt. In that
// case it is the right thing to bail out of this method.
if (_window._currentLanguageBuffer != null && _window._currentLanguageBuffer.IsReadOnly(0))
{
return;
}
if (State == State.ExecutingInput || _window._currentLanguageBuffer == null)
{
AddLanguageBuffer();
......
......@@ -55,12 +55,9 @@ public static ITextSnapshot MockSnapshot(string content)
return snapshotMock.Object;
}
public string GetTextFromCurrentLanguageBuffer
public string GetTextFromCurrentLanguageBuffer()
{
get
{
return Window.CurrentLanguageBuffer.CurrentSnapshot.GetText();
}
return Window.CurrentLanguageBuffer.CurrentSnapshot.GetText();
}
#endregion
......@@ -621,20 +618,23 @@ private void AssertCaretVirtualPosition(int expectedLine, int expectedColumn)
[Fact]
public void CheckHistoryPrevious()
{
const string V = "1 ";
Window.InsertCode(V);
Assert.Equal(V, GetTextFromCurrentLanguageBuffer);
const string inputString = "1 ";
Window.InsertCode(inputString);
Assert.Equal(inputString, GetTextFromCurrentLanguageBuffer());
Task.Run(() => Window.Operations.ExecuteInput()).PumpingWait();
Window.Operations.HistoryPrevious();
Assert.Equal(V, GetTextFromCurrentLanguageBuffer);
Assert.Equal(inputString, GetTextFromCurrentLanguageBuffer());
}
[Fact(Skip = "https://github.com/dotnet/roslyn/issues/4121")]
public void CheckHistoryAfterResetButtonClick()
[Fact]
public void CheckHistoryPreviousAfterReset()
{
Task.Run(() => Window.Operations.ResetAsync(initialize: true)).PumpingWait();
Task.Run(() => Window.Operations.HistoryPrevious()).PumpingWait();
Assert.Equal("#reset", GetTextFromCurrentLanguageBuffer);
const string resetCommand = "#reset";
Window.InsertCode(resetCommand);
Assert.Equal(resetCommand, GetTextFromCurrentLanguageBuffer());
Task.Run(() => Window.Operations.ExecuteInput()).PumpingWait();
Window.Operations.HistoryPrevious();
Assert.Equal(resetCommand, GetTextFromCurrentLanguageBuffer());
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册