@@ -443,6 +443,7 @@ func AssertParse(
443
443
_ markedSource: String ,
444
444
substructure expectedSubstructure: Syntax ? = nil ,
445
445
substructureAfterMarker: String = " START " ,
446
+ substructureCheckTrivia: Bool = false ,
446
447
diagnostics expectedDiagnostics: [ DiagnosticSpec ] = [ ] ,
447
448
applyFixIts: [ String ] ? = nil ,
448
449
fixedSource expectedFixedSource: String ? = nil ,
@@ -454,6 +455,7 @@ func AssertParse(
454
455
{ SourceFileSyntax . parse ( from: & $0) } ,
455
456
substructure: expectedSubstructure,
456
457
substructureAfterMarker: substructureAfterMarker,
458
+ substructureCheckTrivia: substructureCheckTrivia,
457
459
diagnostics: expectedDiagnostics,
458
460
applyFixIts: applyFixIts,
459
461
fixedSource: expectedFixedSource,
@@ -470,6 +472,7 @@ func AssertParse<S: SyntaxProtocol>(
470
472
_ parse: ( inout Parser ) -> S ,
471
473
substructure expectedSubstructure: Syntax ? = nil ,
472
474
substructureAfterMarker: String = " START " ,
475
+ substructureCheckTrivia: Bool = false ,
473
476
diagnostics expectedDiagnostics: [ DiagnosticSpec ] = [ ] ,
474
477
applyFixIts: [ String ] ? = nil ,
475
478
fixedSource expectedFixedSource: String ? = nil ,
@@ -484,6 +487,7 @@ func AssertParse<S: SyntaxProtocol>(
484
487
} ,
485
488
substructure: expectedSubstructure,
486
489
substructureAfterMarker: substructureAfterMarker,
490
+ substructureCheckTrivia: substructureCheckTrivia,
487
491
diagnostics: expectedDiagnostics,
488
492
applyFixIts: applyFixIts,
489
493
fixedSource: expectedFixedSource,
@@ -515,6 +519,7 @@ func AssertParse<S: SyntaxProtocol>(
515
519
_ parse: ( String ) -> S ,
516
520
substructure expectedSubstructure: Syntax ? = nil ,
517
521
substructureAfterMarker: String = " START " ,
522
+ substructureCheckTrivia: Bool = false ,
518
523
diagnostics expectedDiagnostics: [ DiagnosticSpec ] = [ ] ,
519
524
applyFixIts: [ String ] ? = nil ,
520
525
fixedSource expectedFixedSource: String ? = nil ,
@@ -545,7 +550,7 @@ func AssertParse<S: SyntaxProtocol>(
545
550
if let expectedSubstructure = expectedSubstructure {
546
551
let subtreeMatcher = SubtreeMatcher ( Syntax ( tree) , markers: markerLocations)
547
552
do {
548
- try subtreeMatcher. assertSameStructure ( afterMarker: substructureAfterMarker, Syntax ( expectedSubstructure) , file: file, line: line)
553
+ try subtreeMatcher. assertSameStructure ( afterMarker: substructureAfterMarker, Syntax ( expectedSubstructure) , includeTrivia : substructureCheckTrivia , file: file, line: line)
549
554
} catch {
550
555
XCTFail ( " Matching for a subtree failed with error: \( error) " , file: file, line: line)
551
556
}
0 commit comments