Skip to content

Commit 20e94b8

Browse files
committed
Swift: add more tests for the generated parent-child relationship
1 parent 105c0d0 commit 20e94b8

File tree

6 files changed

+1347
-0
lines changed

6 files changed

+1347
-0
lines changed

swift/ql/test/library-tests/parent/child.expected

Lines changed: 1319 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import swift
2+
import codeql.swift.generated.ParentChild
3+
import TestUtils
4+
5+
from AstNode parent, AstNode child, int index, string accessor
6+
where
7+
toBeTested(parent) and
8+
child = getImmediateChildAndAccessor(parent, index, accessor)
9+
select parent, index, accessor, child

swift/ql/test/library-tests/parent/no_double_children.expected

Whitespace-only changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import swift
2+
private import codeql.swift.generated.ParentChild
3+
4+
from AstNode parent, int index, AstNode child1, AstNode child2
5+
where
6+
child1 != child2 and
7+
child1 = getImmediateChildAndAccessor(parent, index, _) and
8+
child2 = getImmediateChildAndAccessor(parent, index, _)
9+
select parent, parent.getPrimaryQlClasses(), index, child1, child1.getPrimaryQlClasses(), child2,
10+
child2.getPrimaryQlClasses()

swift/ql/test/library-tests/parent/no_double_indexes.expected

Whitespace-only changes.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import swift
2+
private import codeql.swift.generated.ParentChild
3+
4+
from AstNode parent, int index1, int index2, AstNode child
5+
where
6+
index1 != index2 and
7+
child = getImmediateChildAndAccessor(parent, index1, _) and
8+
child = getImmediateChildAndAccessor(parent, index2, _)
9+
select parent, parent.getPrimaryQlClasses(), child, child.getPrimaryQlClasses(), index1, index2

0 commit comments

Comments
 (0)