@@ -18,13 +18,6 @@ import SwiftSyntax
18
18
import SwiftSyntaxMacros
19
19
import XCTest
20
20
21
- private extension String {
22
- // This implementation is really slow; to use it outside a test it should be optimized.
23
- func trimmingTrailingWhitespace( ) -> String {
24
- return self . replacingOccurrences ( of: " [ ]+ \\ n " , with: " \n " , options: . regularExpression)
25
- }
26
- }
27
-
28
21
// MARK: - Note
29
22
30
23
/// Describes a diagnostic note that tests expect to be created by a macro expansion.
@@ -210,8 +203,8 @@ func assertDiagnostic<T: SyntaxProtocol>(
210
203
}
211
204
212
205
assertStringsEqualWithDiff (
213
- highlightedCode. trimmingTrailingWhitespace ( ) ,
214
- highlight. trimmingTrailingWhitespace ( ) ,
206
+ highlightedCode,
207
+ highlight,
215
208
" highlight does not match " ,
216
209
file: spec. originatorFile,
217
210
line: spec. originatorLine
@@ -255,7 +248,7 @@ func assertDiagnostic<T: SyntaxProtocol>(
255
248
/// macros in various places (e.g., `#stringify(x + y)`).
256
249
/// - expandedSource: The source code that we expect to see after performing
257
250
/// macro expansion on the original source.
258
- /// - diagnostics:
251
+ /// - diagnostics: The diagnostics when expanding any macro
259
252
/// - macros: The macros that should be expanded, provided as a dictionary
260
253
/// mapping macro names (e.g., `"stringify"`) to implementation types
261
254
/// (e.g., `StringifyMacro.self`).
@@ -282,8 +275,8 @@ public func assertMacroExpansion(
282
275
let expandedSourceFile = origSourceFile. expand ( macros: macros, in: context) . formatted ( using: BasicFormat ( indentationWidth: indentationWidth) )
283
276
284
277
assertStringsEqualWithDiff (
285
- expandedSourceFile. description. trimmingTrailingWhitespace ( ) ,
286
- expandedSource. trimmingTrailingWhitespace ( ) ,
278
+ expandedSourceFile. description,
279
+ expandedSource,
287
280
file: file,
288
281
line: line
289
282
)
0 commit comments