Skip to content

Commit c1cae12

Browse files
fix: Reformat Visitor types to support old Swift versions
1 parent 07ad62b commit c1cae12

File tree

1 file changed

+2
-48
lines changed

1 file changed

+2
-48
lines changed

Tests/GraphQLTests/LanguageTests/VisitorTests.swift

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,7 @@ class VisitorTests: XCTestCase {
88
}
99

1010
func testValidatesPathArgument() throws {
11-
struct VisitedElement: Equatable {
12-
let direction: VisitDirection
13-
let path: [any IndexPathElement]
14-
15-
init(_ direction: VisitDirection, _ path: [any IndexPathElement]) {
16-
self.direction = direction
17-
self.path = path
18-
}
19-
20-
static func == (lhs: VisitedElement, rhs: VisitedElement) -> Bool {
21-
return lhs.direction == rhs.direction &&
22-
zip(lhs.path, rhs.path).allSatisfy { lhs, rhs in
23-
lhs.description == rhs.description
24-
}
25-
}
26-
}
27-
28-
var visited = [VisitedElement]()
11+
var visited = [VisitedPath]()
2912
let ast = try parse(source: "{ a }", noLocation: true)
3013

3114
visit(root: ast, visitor: .init(
@@ -513,36 +496,7 @@ class VisitorTests: XCTestCase {
513496
}
514497

515498
func testProperlyVisitsTheKitchenSinkQuery() throws {
516-
struct VisitedElement: Equatable, CustomDebugStringConvertible {
517-
var debugDescription: String {
518-
"(\(direction), \(kind), \(key.debugDescription), \(parentKind.debugDescription))"
519-
}
520-
521-
let direction: VisitDirection
522-
let kind: Kind
523-
let key: (any IndexPathElement)?
524-
let parentKind: Kind?
525-
526-
init(
527-
_ direction: VisitDirection,
528-
_ kind: Kind,
529-
_ key: (any IndexPathElement)?,
530-
_ parentKind: Kind?
531-
) {
532-
self.direction = direction
533-
self.kind = kind
534-
self.key = key
535-
self.parentKind = parentKind
536-
}
537-
538-
static func == (lhs: VisitedElement, rhs: VisitedElement) -> Bool {
539-
return lhs.direction == rhs.direction &&
540-
lhs.kind == rhs.kind &&
541-
lhs.key?.description == rhs.key?.description &&
542-
lhs.parentKind == rhs.parentKind
543-
}
544-
}
545-
var visited = [VisitedElement]()
499+
var visited = [VisitedKindAndParent]()
546500

547501
guard
548502
let url = Bundle.module.url(forResource: "kitchen-sink", withExtension: "graphql"),

0 commit comments

Comments
 (0)