Skip to content

Commit cf128b1

Browse files
committed
Add testcases
1 parent 44162b5 commit cf128b1

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

Tests/SwiftSyntaxBuilderTest/CollectionNodeFlatteningTests.swift

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,19 @@ final class CollectionNodeFlatteningTests: XCTestCase {
4646
"""
4747
)
4848
}
49+
50+
func test_FlattenCodeBlockItemListWithCodeBlockStrings() {
51+
let buildable = CodeBlockItemListSyntax {
52+
"let one = object.methodOne()"
53+
"let two = object.methodTwo()"
54+
}
55+
56+
AssertBuildResult(
57+
buildable,
58+
"""
59+
let one = object.methodOne()
60+
let two = object.methodTwo()
61+
"""
62+
)
63+
}
4964
}

Tests/SwiftSyntaxBuilderTest/StringInterpolationTests.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -460,4 +460,23 @@ final class StringInterpolationTests: XCTestCase {
460460
)
461461
}
462462
}
463+
464+
func testCodeBlockItemInterpolation() {
465+
let codeBlock = CodeBlockItemSyntax(
466+
"""
467+
func foo() {
468+
return bar
469+
}
470+
"""
471+
)
472+
473+
AssertStringsEqualWithDiff(
474+
codeBlock.description,
475+
"""
476+
func foo() {
477+
return bar
478+
}
479+
"""
480+
)
481+
}
463482
}

0 commit comments

Comments
 (0)