Skip to content

Commit 2af3fb5

Browse files
committed
add test for predicateExpr
1 parent 9d9663d commit 2af3fb5

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

ql/test/callgraph/Foo.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,11 @@ module Buildins {
3737

3838
predicate regexpCapture(string s) { "foo".regexpCapture("\\w", 1) = s }
3939
}
40+
41+
cached
42+
newtype TApiNode = MkRoot()
43+
44+
private predicate edge(TApiNode a, TApiNode b) { a = b }
45+
46+
cached
47+
int distanceFromRoot(TApiNode nd) = shortestDistances(MkRoot/0, edge/2)(_, nd, result)

ql/test/callgraph/callgraph.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,7 @@ getTarget
2222
| packs/src/SrcThing.qll:5:3:5:8 | PredicateCall | packs/src/SrcThing.qll:8:1:8:30 | ClasslessPredicate bar |
2323
dependsOn
2424
| packs/src/qlpack.yml:1:1:1:4 | ql-testing-src-pack | packs/lib/qlpack.yml:1:1:1:4 | ql-testing-lib-pack |
25+
exprPredicate
26+
| Foo.qll:24:22:24:31 | predicate | Foo.qll:22:3:22:32 | ClasslessPredicate myThing0 |
27+
| Foo.qll:26:22:26:31 | predicate | Foo.qll:20:3:20:54 | ClasslessPredicate myThing2 |
28+
| Foo.qll:47:65:47:70 | predicate | Foo.qll:44:9:44:56 | ClasslessPredicate edge |

ql/test/callgraph/callgraph.ql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@ import ql
33
query AstNode getTarget(Call call) { result = call.getTarget() }
44

55
query YAML::QLPack dependsOn(YAML::QLPack pack) { result = pack.getADependency() }
6+
7+
query Predicate exprPredicate(PredicateExpr expr) { result = expr.getResolvedPredicate() }

0 commit comments

Comments
 (0)