@@ -18,13 +18,6 @@ import SwiftSyntax
1818import SwiftSyntaxMacros
1919import XCTest
2020
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-
2821// MARK: - Note
2922
3023/// Describes a diagnostic note that tests expect to be created by a macro expansion.
@@ -210,8 +203,8 @@ func assertDiagnostic<T: SyntaxProtocol>(
210203 }
211204
212205 assertStringsEqualWithDiff (
213- highlightedCode. trimmingTrailingWhitespace ( ) ,
214- highlight. trimmingTrailingWhitespace ( ) ,
206+ highlightedCode,
207+ highlight,
215208 " highlight does not match " ,
216209 file: spec. originatorFile,
217210 line: spec. originatorLine
@@ -255,7 +248,7 @@ func assertDiagnostic<T: SyntaxProtocol>(
255248/// macros in various places (e.g., `#stringify(x + y)`).
256249/// - expandedSource: The source code that we expect to see after performing
257250/// macro expansion on the original source.
258- /// - diagnostics:
251+ /// - diagnostics: The diagnostics when expanding any macro
259252/// - macros: The macros that should be expanded, provided as a dictionary
260253/// mapping macro names (e.g., `"stringify"`) to implementation types
261254/// (e.g., `StringifyMacro.self`).
@@ -282,8 +275,8 @@ public func assertMacroExpansion(
282275 let expandedSourceFile = origSourceFile. expand ( macros: macros, in: context) . formatted ( using: BasicFormat ( indentationWidth: indentationWidth) )
283276
284277 assertStringsEqualWithDiff (
285- expandedSourceFile. description. trimmingTrailingWhitespace ( ) ,
286- expandedSource. trimmingTrailingWhitespace ( ) ,
278+ expandedSourceFile. description,
279+ expandedSource,
287280 file: file,
288281 line: line
289282 )
0 commit comments