Skip to content

Commit 83df5c1

Browse files
committed
(maint) Add tests for code folding for PowerShell classes
Previously there were no tests for PowerShell classes. This commit adds a simple test for this scenario to ensure future changes do not break folding.
1 parent 3505902 commit 83df5c1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/PowerShellEditorServices.Test/Language/TokenOperationsTests.cs

+26
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,31 @@ public void LaguageServiceFindsFoldablRegionsWithSameEndToken() {
260260

261261
AssertFoldingReferenceArrays(expectedFolds, result);
262262
}
263+
264+
// A simple PowerShell Classes test
265+
[Fact]
266+
public void LaguageServiceFindsFoldablRegionsWithClasses() {
267+
string testString =
268+
@"class TestClass {
269+
[string[]] $TestProperty = @(
270+
'first',
271+
'second',
272+
'third')
273+
274+
[string] TestMethod() {
275+
return $this.TestProperty[0]
276+
}
277+
}
278+
";
279+
FoldingReference[] expectedFolds = {
280+
CreateFoldingReference(0, 16, 8, 1, null),
281+
CreateFoldingReference(1, 31, 3, 16, null),
282+
CreateFoldingReference(6, 26, 7, 5, null)
283+
};
284+
285+
FoldingReference[] result = GetRegions(testString);
286+
287+
AssertFoldingReferenceArrays(expectedFolds, result);
288+
}
263289
}
264290
}

0 commit comments

Comments
 (0)