@@ -8,24 +8,7 @@ class VisitorTests: XCTestCase {
8
8
}
9
9
10
10
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] ( )
29
12
let ast = try parse ( source: " { a } " , noLocation: true )
30
13
31
14
visit ( root: ast, visitor: . init(
@@ -513,36 +496,7 @@ class VisitorTests: XCTestCase {
513
496
}
514
497
515
498
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] ( )
546
500
547
501
guard
548
502
let url = Bundle . module. url ( forResource: " kitchen-sink " , withExtension: " graphql " ) ,
0 commit comments