Ruby: add tree-sitter test case

This commit is contained in:
Arthur Baars
2022-04-28 11:36:01 +02:00
parent 6738270b65
commit 7359ffaa2e
2 changed files with 5877 additions and 0 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,31 @@
/**
* @kind graph
*/
import codeql.ruby.ast.internal.TreeSitter::Ruby
/**
* Holds if `node` belongs to the output tree, and its property `key` has the
* given `value`.
*/
query predicate nodes(AstNode node, string key, string value) {
key = "semmle.label" and
value = "[" + node.getPrimaryQlClasses() + "] " + node.toString()
}
/**
* Holds if `target` is a child of `source` in the AST, and property `key` of
* the edge has the given `value`.
*/
query predicate edges(AstNode source, AstNode target, string key, string value) {
source = target.getParent() and
key = ["semmle.label", "semmle.order"] and
value = target.getParentIndex().toString()
}
/**
* Holds if property `key` of the graph has the given `value`.
*/
query predicate graphProperties(string key, string value) {
key = "semmle.graphKind" and value = "tree"
}