Skip to content

Commit f1f90f2

Browse files
committed
Add a test case
1 parent 9d40557 commit f1f90f2

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

Tests/SwiftBasicFormatTest/BasicFormatTests.swift

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ final class BasicFormatTest: XCTestCase {
342342
)
343343
}
344344

345-
func testNodeHavingParentNode() {
345+
func testSubTreeNode() {
346346
let decl: DeclSyntax = """
347347
func test() {
348348
print(1)
@@ -359,4 +359,25 @@ final class BasicFormatTest: XCTestCase {
359359
"""
360360
)
361361
}
362+
363+
func testSubTreeNodeWithIndentedParentNode() {
364+
let decl: DeclSyntax = """
365+
struct X {
366+
func test() {
367+
print(1)
368+
}
369+
}
370+
"""
371+
372+
let body = decl.cast(StructDeclSyntax.self).memberBlock.members.first!.decl.cast(FunctionDeclSyntax.self).body!
373+
374+
assertFormatted(
375+
source: body.formatted().description,
376+
expected: """
377+
{
378+
print(1)
379+
}
380+
"""
381+
)
382+
}
362383
}

0 commit comments

Comments
 (0)