From c8d03849074e269af449d7728a8cafe45f3b9e38 Mon Sep 17 00:00:00 2001 From: Erik Krogh Kristensen Date: Sat, 29 May 2021 08:34:09 +0000 Subject: [PATCH] add callgraph test --- ql/test/callgraph/Foo.qll | 15 +++++++++++++++ ql/test/callgraph/callgraph.expected | 3 +++ ql/test/callgraph/callgraph.ql | 3 +++ 3 files changed, 21 insertions(+) create mode 100644 ql/test/callgraph/Foo.qll create mode 100644 ql/test/callgraph/callgraph.expected create mode 100644 ql/test/callgraph/callgraph.ql diff --git a/ql/test/callgraph/Foo.qll b/ql/test/callgraph/Foo.qll new file mode 100644 index 00000000000..b289193b5e8 --- /dev/null +++ b/ql/test/callgraph/Foo.qll @@ -0,0 +1,15 @@ +import ql + +predicate foo() { none() } + +query predicate test() { foo() } + +class Foo extends AstNode { + predicate bar() { none() } + + predicate baz() { bar() } +} + +class Sub extends Foo { + override predicate baz() { super.baz() } +} diff --git a/ql/test/callgraph/callgraph.expected b/ql/test/callgraph/callgraph.expected new file mode 100644 index 00000000000..497b6e6591e --- /dev/null +++ b/ql/test/callgraph/callgraph.expected @@ -0,0 +1,3 @@ +| Foo.qll:5:26:5:30 | PredicateCall | Foo.qll:3:1:3:26 | foo | +| Foo.qll:10:21:10:25 | PredicateCall | Foo.qll:8:3:8:28 | ClassPredicate | +| Foo.qll:14:30:14:40 | MemberCall | Foo.qll:10:3:10:27 | ClassPredicate | diff --git a/ql/test/callgraph/callgraph.ql b/ql/test/callgraph/callgraph.ql new file mode 100644 index 00000000000..ef5aecf1bbc --- /dev/null +++ b/ql/test/callgraph/callgraph.ql @@ -0,0 +1,3 @@ +import ql + +query AstNode getTarget(Call call) { result = call.getTarget().getDeclaration() }