File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Sources/InlineSnapshotTesting
Tests/InlineSnapshotTestingTests Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -504,6 +504,18 @@ private final class SnapshotRewriter: SyntaxRewriter {
504504 fatalError ( )
505505 }
506506 }
507+
508+ if
509+ functionCallExpr. arguments. isEmpty,
510+ functionCallExpr. trailingClosure != nil ,
511+ functionCallExpr. leftParen != nil ,
512+ functionCallExpr. rightParen != nil
513+ {
514+ functionCallExpr. leftParen = nil
515+ functionCallExpr. rightParen = nil
516+ functionCallExpr. calledExpression. trailingTrivia = . space
517+ }
518+
507519 return ExprSyntax ( functionCallExpr)
508520 }
509521}
Original file line number Diff line number Diff line change @@ -103,6 +103,37 @@ final class InlineSnapshotTestingTests: XCTestCase {
103103 )
104104 }
105105
106+ func testArgumentlessInlineSnapshot( ) {
107+ func assertArgumentlessInlineSnapshot(
108+ expected: ( ( ) -> String ) ? = nil ,
109+ file: StaticString = #filePath,
110+ function: StaticString = #function,
111+ line: UInt = #line,
112+ column: UInt = #column
113+ ) {
114+ assertInlineSnapshot (
115+ of: " Hello " ,
116+ as: . dump,
117+ syntaxDescriptor: InlineSnapshotSyntaxDescriptor (
118+ trailingClosureLabel: " is " ,
119+ trailingClosureOffset: 1
120+ ) ,
121+ matches: expected,
122+ file: file,
123+ function: function,
124+ line: line,
125+ column: column
126+ )
127+ }
128+
129+ assertArgumentlessInlineSnapshot {
130+ """
131+ - " Hello "
132+
133+ """
134+ }
135+ }
136+
106137 func testMultipleInlineSnapshots( ) {
107138 func assertResponse(
108139 of url: ( ) -> String ,
You can’t perform that action at this time.
0 commit comments