Skip to content

Commit 5e42b68

Browse files
committed
added SCP service test, ref. #4460 (passes)
1 parent e8564b4 commit 5e42b68

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Rubberduck.Core/AutoComplete/Service/SelfClosingPairCompletionService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ private CodeString HandleOpeningChar(SelfClosingPair pair, CodeString original)
7878
var line = lines[original.CaretPosition.StartLine];
7979

8080
string newCode;
81-
if (string.IsNullOrEmpty(original.Code))
81+
if (string.IsNullOrEmpty(line))
8282
{
8383
newCode = autoCode;
8484
}

RubberduckTests/AutoComplete/SelfClosingPairCompletionTests.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,22 @@ public void DeletingOpeningChar_IndexExpr()
176176
Assert.AreEqual(expected, result);
177177
}
178178

179+
[Test] // ref. #4460
180+
public void OpeningOnSecondLineDoesNotJumpToEndOfLine()
181+
{
182+
var pair = new SelfClosingPair('"', '"');
183+
var input = '"';
184+
var original = @"
185+
ExecuteStoredProcedure (""AddAppointmentCountForAClinic"", False,dbconfig.SQLConString, _
186+
| thisClinic.ClinicID ,".ToCodeString();
187+
var expected = @"
188+
ExecuteStoredProcedure (""AddAppointmentCountForAClinic"", False,dbconfig.SQLConString, _
189+
""|"" thisClinic.ClinicID ,".ToCodeString();
190+
191+
var result = Run(pair, original, input);
192+
Assert.AreEqual(expected, result);
193+
}
194+
179195
[Test]
180196
public void DeletingOpeningCharRemovesPairedClosingChar_NestedParensMultiline()
181197
{

0 commit comments

Comments
 (0)