Skip to content

Commit ee52fb7

Browse files
committed
fixed broken test setup
1 parent 9fb8d24 commit ee52fb7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Rubberduck.VBEEditor/SourceCodeHandling/CodePaneSourceCodeHandler.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,8 @@ public CodeString GetCurrentLogicalLine(ICodeModule module)
184184
pSelection = pane.Selection;
185185
}
186186

187-
var selectedLines = module.GetLines(pSelection.StartLine, pSelection.LineCount).Replace("\r", string.Empty).Split('\n');
187+
var selectedContent = module.GetLines(pSelection.StartLine, pSelection.LineCount);
188+
var selectedLines = selectedContent.Replace("\r", string.Empty).Split('\n');
188189
var currentLine = selectedLines[0];
189190

190191
var caretStartLine = (pSelection.StartLine, currentLine);

RubberduckTests/AutoComplete/SmartConcatCompletionTests.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void SplittingExistingString_PutsCaretAtSameRelativePosition()
7676

7777
private static TestCodeString Run(TestCodeString original, char input, bool isCtrlDown = false, bool isDeleteKey = false)
7878
{
79+
7980
var sut = InitializeSut(original, out var module, out var settings);
8081
var args = new AutoCompleteEventArgs(module.Object, input, isCtrlDown, isDeleteKey);
8182

@@ -102,7 +103,9 @@ private static SmartConcatenationHandler InitializeSut(TestCodeString original,
102103
module = new Mock<ICodeModule>();
103104
pane = new Mock<ICodePane>();
104105
pane.SetupProperty(m => m.Selection);
105-
pane.Object.Selection = new Selection(original.SnippetPosition.StartLine, 1, original.SnippetPosition.EndLine, 1).Offset(original.CaretPosition);
106+
var paneSelection = new Selection(original.SnippetPosition.StartLine + original.CaretPosition.StartLine, original.CaretPosition.StartColumn + 1);
107+
pane.Object.Selection = paneSelection;
108+
106109
module.Setup(m => m.DeleteLines(original.SnippetPosition.StartLine, original.SnippetPosition.LineCount));
107110
module.Setup(m => m.InsertLines(original.SnippetPosition.StartLine, original.Code));
108111
module.Setup(m => m.CodePane).Returns(pane.Object);
@@ -112,6 +115,7 @@ private static SmartConcatenationHandler InitializeSut(TestCodeString original,
112115
module.Setup(m => m.GetLines(index + 1, 1)).Returns(original.Lines[index]);
113116
}
114117
module.Setup(m => m.GetLines(original.SnippetPosition)).Returns(prettified.Code);
118+
module.Setup(m => m.GetLines(paneSelection.StartLine, paneSelection.LineCount)).Returns(prettified.CaretLine);
115119

116120
settings = new AutoCompleteSettings {IsEnabled = true};
117121
settings.SmartConcat.IsEnabled = true;

0 commit comments

Comments
 (0)