Skip to content

Commit e4ac1df

Browse files
committed
Tests for missing cases of GetBodyStart.
1 parent 738320e commit e4ac1df

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

Tests/External/Plugins/ASCompletion.Tests/Completion/ASGeneratorTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,34 @@ public void GetBodyStart_SimpleCase()
5151
Assert.AreEqual(26, funcBodyStart);
5252
}
5353

54+
[Test]
55+
public void GetBodyStart_EndOnSecondLine()
56+
{
57+
var sci = GetBaseScintillaControl();
58+
// TODO: Should we reindent second line?
59+
sci.Text = "function test():void{\r\n\t\t\t}";
60+
sci.ConfigurationLanguage = "haxe";
61+
sci.Colourise(0, -1);
62+
int funcBodyStart = ASGenerator.GetBodyStart(0, 1, sci);
63+
64+
Assert.AreEqual(26, funcBodyStart);
65+
Assert.AreEqual("function test():void{\r\n\t\t\t\r\n}", sci.Text);
66+
}
67+
68+
[Test]
69+
public void GetBodyStart_CharOnSecondLine()
70+
{
71+
var sci = GetBaseScintillaControl();
72+
// TODO: Should we reindent second line?
73+
sci.Text = "function test():void{\r\n\t\t\t//comment}";
74+
sci.ConfigurationLanguage = "haxe";
75+
sci.Colourise(0, -1);
76+
int funcBodyStart = ASGenerator.GetBodyStart(0, 1, sci);
77+
78+
Assert.AreEqual(26, funcBodyStart);
79+
Assert.AreEqual("function test():void{\r\n\t\t\t//comment}", sci.Text);
80+
}
81+
5482
[Test]
5583
public void GetBodyStart_EndOnSameDeclarationLine()
5684
{

0 commit comments

Comments
 (0)