Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8d60336

Browse files
committed
add tests for callsite filters
1 parent 20992af commit 8d60336

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

python/ql/test/library-tests/frameworks/data/test.expected

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@ isSink
1717
| test.py:17:31:17:34 | ControlFlowNode for four | test-source |
1818
| test.py:18:37:18:40 | ControlFlowNode for five | test-source |
1919
| test.py:19:21:19:26 | ControlFlowNode for second | test-source |
20+
| test.py:30:21:30:23 | ControlFlowNode for one | test-source |
21+
| test.py:32:22:32:24 | ControlFlowNode for one | test-source |
22+
| test.py:32:27:32:29 | ControlFlowNode for two | test-source |
23+
| test.py:33:22:33:24 | ControlFlowNode for one | test-source |
24+
| test.py:33:27:33:29 | ControlFlowNode for two | test-source |
25+
| test.py:33:32:33:36 | ControlFlowNode for three | test-source |
2026
isSource
2127
| test.py:3:5:3:15 | ControlFlowNode for getSource() | test-source |
2228
| test.py:9:8:9:14 | ControlFlowNode for alias() | test-source |

python/ql/test/library-tests/frameworks/data/test.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,12 @@
2222

2323
Callbacks.first(lambda one, two, three, four, five: 0)
2424
Callbacks.param1to3(lambda one, two, three, four, five: 0)
25-
Callbacks.nonFirst(lambda first, second: 0)
25+
Callbacks.nonFirst(lambda first, second: 0)
26+
27+
from testlib import CallFilter
28+
29+
CallFilter.arityOne(one, two) # NO match
30+
CallFilter.arityOne(one) # Match
31+
CallFilter.twoOrMore(one) # NO match
32+
CallFilter.twoOrMore(one, two) # Match
33+
CallFilter.twoOrMore(one, two, three) # Match

python/ql/test/library-tests/frameworks/data/test.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ class Sinks extends ModelInput::SinkModelCsv {
4646
"testlib;;Member[Args].Member[arg1to3].Argument[1..3];test-source", //
4747
"testlib;;Member[Args].Member[lastarg].Argument[N-1];test-source", //
4848
"testlib;;Member[Args].Member[nonFist].Argument[1..];test-source", //
49+
// callsite filter.
50+
"testlib;;Member[CallFilter].Member[arityOne].WithArity[1].Argument[0..];test-source", //
51+
"testlib;;Member[CallFilter].Member[twoOrMore].WithArity[2..].Argument[0..];test-source", //
4952
]
5053
}
5154
}

0 commit comments

Comments
 (0)