File tree 2 files changed +43
-0
lines changed
Sources/InlineSnapshotTesting
Tests/InlineSnapshotTestingTests
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 {
504
504
fatalError ( )
505
505
}
506
506
}
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
+
507
519
return ExprSyntax ( functionCallExpr)
508
520
}
509
521
}
Original file line number Diff line number Diff line change @@ -103,6 +103,37 @@ final class InlineSnapshotTestingTests: XCTestCase {
103
103
)
104
104
}
105
105
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
+
106
137
func testMultipleInlineSnapshots( ) {
107
138
func assertResponse(
108
139
of url: ( ) -> String ,
You can’t perform that action at this time.
0 commit comments