Skip to content

Commit

Permalink
Merge pull request #39 from Pierce-Evan/evapierce/OptionalActionTestS…
Browse files Browse the repository at this point in the history
…ummaryGroupParams

Setting ActionTestSummaryGroup name and identifier params as optional
  • Loading branch information
davidahouse authored Jul 14, 2021
2 parents 21b70ef + 059bf68 commit 49eec74
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions Sources/XCResultKit/ActionTestSummaryGroup.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@
import Foundation

public struct ActionTestSummaryGroup: XCResultObject {
public let name: String
public let identifier: String
public let name: String?
public let identifier: String?
public let duration: Double
public let subtestGroups: [ActionTestSummaryGroup]
public let subtests: [ActionTestMetadata]

public init?(_ json: [String: AnyObject]) {
do {
name = try xcRequired(element: "name", from: json)
identifier = try xcRequired(element: "identifier", from: json)
duration = xcOptional(element: "duration", from: json) ?? 0.0
subtestGroups = xcArray(element: "subtests", from: json)
.ofType(ActionTestSummaryGroup.self)
subtests = xcArray(element: "subtests", from: json)
.ofType(ActionTestMetadata.self)
} catch {
logError("Error parsing ActionTestSummaryGroup: \(error.localizedDescription)")
return nil
}
name = xcOptional(element: "name", from: json)
identifier = xcOptional(element: "identifier", from: json)
duration = xcOptional(element: "duration", from: json) ?? 0.0
subtestGroups = xcArray(element: "subtests", from: json)
.ofType(ActionTestSummaryGroup.self)
subtests = xcArray(element: "subtests", from: json)
.ofType(ActionTestMetadata.self)

}
}

0 comments on commit 49eec74

Please sign in to comment.