public void CurrentMatchChanged_OnEnter() { Create("cat", "cat", "rabbit", "tree"); VeriyCurrentMatchChanged( () => _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent)), _textBuffer.GetLine(0).Extent); }
public void InputLast_OnlyOneMatch() { Create("cat", "dog", "rabbit", "tree"); _mode.OnEnter(VimUtil.CreateSubstituteArgument(_textBuffer.GetLine(0).Extent, "cat", "bird")); Assert.IsTrue(_mode.Process('l').IsSwitchMode(ModeKind.Normal)); Assert.AreEqual("bird", _textBuffer.GetLine(0).GetText()); }
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.IsTrue(_mode.Process('y').IsSwitchMode(ModeKind.Normal)); Assert.AreEqual("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 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.IsTrue(_mode.Process('y').IsHandledNoSwitch()); Assert.AreEqual("bird", _textBuffer.GetLine(0).GetText()); Assert.AreEqual(_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.IsTrue(_mode.Process('y').IsHandledNoSwitch()); Assert.AreEqual("bird cat", _textBuffer.GetLine(0).GetText()); Assert.AreEqual(_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.AreEqual(_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.IsTrue(_mode.Process('q').IsSwitchMode(ModeKind.Normal)); }