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

Skip to content

Commit 35b143a

Browse files
committed
add tests for argument syntax
1 parent 86a9bc6 commit 35b143a

3 files changed

Lines changed: 24 additions & 3 deletions

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
@@ -11,6 +11,12 @@ isSink
1111
| test.py:10:8:10:22 | ControlFlowNode for Attribute() | test-sink |
1212
| test.py:11:8:11:30 | ControlFlowNode for Attribute() | test-sink |
1313
| test.py:12:8:12:34 | ControlFlowNode for Attribute() | test-sink |
14+
| test.py:16:11:16:13 | ControlFlowNode for one | test-source |
15+
| test.py:17:19:17:21 | ControlFlowNode for two | test-source |
16+
| test.py:17:24:17:28 | ControlFlowNode for three | test-source |
17+
| test.py:17:31:17:34 | ControlFlowNode for four | test-source |
18+
| test.py:18:37:18:40 | ControlFlowNode for five | test-source |
19+
| test.py:19:21:19:26 | ControlFlowNode for second | test-source |
1420
isSource
1521
| test.py:3:5:3:15 | ControlFlowNode for getSource() | test-source |
1622
| test.py:9:8:9:14 | ControlFlowNode for alias() | test-source |

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,11 @@
99
mySink(alias()) # NOT OK
1010
mySink(alias().chain()) # NOT OK
1111
mySink(alias().chain().chain()) # NOT OK
12-
mySink(alias().chain().safeThing()) # OK
12+
mySink(alias().chain().safeThing()) # OK
13+
14+
from testlib import Args
15+
16+
Args.arg0(one, two, three, four, five)
17+
Args.arg1to3(one, two, three, four, five)
18+
Args.lastarg(one, two, three, four, five)
19+
Args.nonFist(first, second)

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,15 @@ class Types extends ModelInput::TypeModelCsv {
3838
class Sinks extends ModelInput::SinkModelCsv {
3939
override predicate row(string row) {
4040
// package;type;path;kind
41-
row = ["testlib;;Member[mySink].Argument[0,sinkName:];test-sink"]
41+
row =
42+
[
43+
"testlib;;Member[mySink].Argument[0,sinkName:];test-sink",
44+
// testing argument syntax
45+
"testlib;;Member[Args].Member[arg0].Argument[0];test-source", //
46+
"testlib;;Member[Args].Member[arg1to3].Argument[1..3];test-source", //
47+
"testlib;;Member[Args].Member[lastarg].Argument[N-1];test-source", //
48+
"testlib;;Member[Args].Member[nonFist].Argument[1..];test-source", //
49+
]
4250
}
4351
}
4452

@@ -52,7 +60,7 @@ class Sources extends ModelInput::SourceModelCsv {
5260
row =
5361
[
5462
"testlib;;Member[getSource].ReturnValue;test-source", //
55-
"testlib;Alias;;test-source"
63+
"testlib;Alias;;test-source",
5664
]
5765
}
5866
}

0 commit comments

Comments
 (0)