@@ -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,8 @@ 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 expansion of the macro is expectd to
252+ /// produce
259253/// - macros: The macros that should be expanded, provided as a dictionary
260254/// mapping macro names (e.g., `"stringify"`) to implementation types
261255/// (e.g., `StringifyMacro.self`).
@@ -282,8 +276,8 @@ public func assertMacroExpansion(
282276 let expandedSourceFile = origSourceFile. expand ( macros: macros, in: context) . formatted ( using: BasicFormat ( indentationWidth: indentationWidth) )
283277
284278 assertStringsEqualWithDiff (
285- expandedSourceFile. description. trimmingTrailingWhitespace ( ) ,
286- expandedSource. trimmingTrailingWhitespace ( ) ,
279+ expandedSourceFile. description,
280+ expandedSource,
287281 file: file,
288282 line: line
289283 )
0 commit comments