File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,20 @@ public class ParserTests: XCTestCase {
18
18
let fileContents = try String ( contentsOf: fileURL)
19
19
let parsed = try Parser . parse ( source: fileContents)
20
20
AssertStringsEqualWithDiff ( " \( parsed) " , fileContents)
21
+ let diagnostics = ParseDiagnosticsGenerator . diagnostics ( for: parsed)
22
+ if !diagnostics. isEmpty {
23
+ var locationAndDiagnostics : [ String ] = [ ]
24
+ let locationConverter = SourceLocationConverter ( file: fileURL. lastPathComponent, tree: parsed)
25
+ for diag in diagnostics {
26
+ let location = diag. location ( converter: locationConverter)
27
+ let message = diag. message
28
+ locationAndDiagnostics. append ( " \( location) : \( message) " )
29
+ }
30
+ XCTFail ( """
31
+ Received the following diagnostics while parsing \( fileURL)
32
+ \( locationAndDiagnostics. joined ( separator: " \n " ) )
33
+ """ )
34
+ }
21
35
} ( ) )
22
36
}
23
37
}
You can’t perform that action at this time.
0 commit comments