Skip to content

Commit bfe7e0a

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 c7de2aa commit bfe7e0a

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/PowerShellEditorServices.Test/Language/TokenOperationsTests.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,29 @@ public void LaguageServiceFindsFoldablRegionsWithSameEndToken() {
254254

255255
AssertFoldingReferenceArrays(expectedFolds, result);
256256
}
257+
258+
// A simple PowerShell Classes test
259+
[Fact]
260+
public void LaguageServiceFindsFoldablRegionsWithClasses() {
261+
string testString =
262+
@"class TestClass {
263+
[string[]] $TestProperty = @(
264+
'first',
265+
'second',
266+
'third')
267+
268+
[string] TestMethod() {
269+
return $this.TestProperty[0]
270+
}
271+
}
272+
";
273+
FoldingReference[] expectedFolds = {
274+
CreateFoldingReference(0, 0, 9, 1, null),
275+
CreateFoldingReference(1, 31, 4, 16, null),
276+
CreateFoldingReference(6, 26, 8, 5, null)
277+
};
278+
279+
FoldingReference[] result = GetRegions(testString);
280+
}
257281
}
258282
}

0 commit comments

Comments
 (0)