Skip to content

Commit b76c946

Browse files
committed
[benchmark][Gardening] processArguments is init
Processing command line arguments is an integral part of `TestConfig` initialization. Make it explicit.
1 parent f2c4262 commit b76c946

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

benchmark/utils/DriverUtils.swift

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct TestConfig {
6969

7070
var action: TestAction = .run
7171

72-
mutating func processArguments() throws -> TestAction {
72+
init() throws {
7373
let validOptions = [
7474
"--iter-scale", "--num-samples", "--num-iters",
7575
"--verbose", "--delim", "--list", "--sleep",
@@ -127,7 +127,6 @@ struct TestConfig {
127127
try optionalArg("--list", \.action, defaultValue: .listTests)
128128
try optionalArg("--help", \.action, defaultValue: .help(validOptions))
129129

130-
return action
131130
}
132131

133132
mutating func findTestsToRun() {
@@ -410,9 +409,9 @@ func runBenchmarks(_ c: TestConfig) {
410409
}
411410

412411
public func main() {
413-
var config = TestConfig()
414412
do {
415-
switch (try config.processArguments()) {
413+
var config = try TestConfig()
414+
switch (config.action) {
416415
case let .help(validOptions):
417416
print("Valid options:")
418417
for v in validOptions {

0 commit comments

Comments
 (0)