public void InputLast_OnlyOneMatch() { Create("cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); Assert.True(_mode.Process('l').IsSwitchMode(ModeKind.Normal)); Assert.Equal("bird", _textBuffer.GetLine(0).GetText()); }
public void InputYes_OnlyOneMatchInBuffer() { Create("cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); _mode.Process('y'); Assert.Equal("bird", _textBuffer.GetLine(0).GetText()); }
public void CurrentMatchChanged_OnEnter() { Create("cat", "cat", "rabbit", "tree"); VeriyCurrentMatchChanged( () => _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent)), _textBuffer.GetLine(0).Extent); }
public void InputYes_TwoMatchesOnLineButNotReplaceAll() { Create("cat cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetSpan(0, 3), "cat", "bird", range: _textBuffer.GetLineRange(0))); Assert.True(_mode.Process('y').IsSwitchMode(ModeKind.Normal)); Assert.Equal("bird cat", _textBuffer.GetLine(0).GetText()); }
public void CurrentMatchChanged_OnYesGoesToNext() { Create("cat", "cat", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); VeriyCurrentMatchChanged( () => { _mode.Process('y'); }, () => _textBuffer.GetLine(1).Extent); }
public void CurrentMatchChanged_OnYesEnds() { Create("cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); VeriyCurrentMatchChanged( () => { _mode.Process('y'); }, expected: null); }
public void InputAll_TwoMatchesInRange() { Create("cat", "cat", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); Assert.True(_mode.Process('a').IsSwitchMode(ModeKind.Normal)); Assert.Equal("bird", _textBuffer.GetLine(0).GetText()); Assert.Equal("bird", _textBuffer.GetLine(1).GetText()); }
public void InputYes_TwoMatchesInRange() { Create("cat", "cat", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird", SubstituteFlags.ReplaceAll, range: _textBuffer.GetLineRange(0, 1))); Assert.True(_mode.Process('y').IsHandledNoSwitch()); Assert.Equal("bird", _textBuffer.GetLine(0).GetText()); Assert.Equal(_textBuffer.GetLine(1).Extent, _mode.CurrentMatch.Value); }
public void InputYes_TwoMatchesOnLineAndReplaceAll() { Create("cat cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetSpan(0, 3), "cat", "bird", SubstituteFlags.ReplaceAll, range: _textBuffer.GetLineRange(0))); _operations.Setup(x => x.MoveCaretToPointAndEnsureVisible(_textBuffer.GetPoint(5))).Verifiable(); Assert.True(_mode.Process('y').IsHandledNoSwitch()); Assert.Equal("bird cat", _textBuffer.GetLine(0).GetText()); Assert.Equal(_textBuffer.GetSpan(5, 3), _mode.CurrentMatch.Value); _factory.Verify(); }
public void OnEnter_StandardArgument() { Create("cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "a", "b")); Assert.Equal(_textBuffer.GetLine(0).Extent, _mode.CurrentMatch.Value); }
public void InputQuit_InMatch() { Create("cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); Assert.True(_mode.Process('q').IsSwitchMode(ModeKind.Normal)); }