File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -2550,4 +2550,47 @@ final class DeclarationTests: ParserTestCase {
2550
2550
"""
2551
2551
)
2552
2552
}
2553
+
2554
+ func testFunctionDeclarationWithPlaceholder( ) {
2555
+ assertParse (
2556
+ """
2557
+ func 1️⃣<#name#>(2️⃣<#parameters#>) -> 3️⃣<#return type#> {
2558
+ 4️⃣<#function body#>
2559
+ }
2560
+ """ ,
2561
+ substructure: FunctionDeclSyntax (
2562
+ funcKeyword: . keyword( . func) ,
2563
+ name: . identifier( " name " ) ,
2564
+ signature: FunctionSignatureSyntax (
2565
+ parameterClause: FunctionParameterClauseSyntax (
2566
+ parameters: FunctionParameterListSyntax ( [ ] )
2567
+ ) ,
2568
+ returnClause: ReturnClauseSyntax (
2569
+ type: IdentifierTypeSyntax (
2570
+ name: . identifier( " return type " )
2571
+ )
2572
+ )
2573
+ ) ,
2574
+ body: CodeBlockSyntax (
2575
+ statements: CodeBlockItemListSyntax ( [
2576
+ CodeBlockItemSyntax (
2577
+ item: . expr(
2578
+ ExprSyntax (
2579
+ EditorPlaceholderExprSyntax (
2580
+ placeholder: . identifier( " function body " )
2581
+ )
2582
+ )
2583
+ )
2584
+ )
2585
+ ] )
2586
+ )
2587
+ ) ,
2588
+ diagnostics: [
2589
+ DiagnosticSpec ( locationMarker: " 1️⃣ " , message: " editor placeholder in source file " ) ,
2590
+ DiagnosticSpec ( locationMarker: " 2️⃣ " , message: " editor placeholder in source file " ) ,
2591
+ DiagnosticSpec ( locationMarker: " 3️⃣ " , message: " editor placeholder in source file " ) ,
2592
+ DiagnosticSpec ( locationMarker: " 4️⃣ " , message: " editor placeholder in source file " ) ,
2593
+ ]
2594
+ )
2595
+ }
2553
2596
}
You can’t perform that action at this time.
0 commit comments