Skip to content

Commit 9219b07

Browse files
authored
Merge pull request #326 from ahoppen/pr/syntax-classifier-performance-tests
Add test case that tests the performance of the SyntaxClassifier
2 parents 01817b6 + 148f6ca commit 9219b07

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import XCTest
2+
import SwiftSyntax
3+
import SwiftSyntaxParser
4+
5+
public class SyntaxClassifierPerformanceTests: XCTestCase {
6+
7+
var inputFile: URL {
8+
return URL(fileURLWithPath: #file)
9+
.deletingLastPathComponent()
10+
.appendingPathComponent("Inputs")
11+
.appendingPathComponent("MinimalCollections.swift.input")
12+
}
13+
14+
func testParsingPerformance() {
15+
XCTAssertNoThrow(try {
16+
let parsed = try SyntaxParser.parse(inputFile)
17+
18+
measure {
19+
for _ in 0..<10 {
20+
for _ in parsed.classifications {}
21+
}
22+
}
23+
}())
24+
}
25+
}

0 commit comments

Comments
 (0)