mirror of
https://github.com/github/codeql.git
synced 2026-05-05 05:35:13 +02:00
Python: Add a way to easily specify constant values for in new Value API.
This commit is contained in:
16
python/ql/test/library-tests/PointsTo/api/Constants.expected
Normal file
16
python/ql/test/library-tests/PointsTo/api/Constants.expected
Normal file
@@ -0,0 +1,16 @@
|
||||
| 1 | file://:0:0:0:0 | int 1 |
|
||||
| 2 | file://:0:0:0:0 | int 2 |
|
||||
| 3 | file://:0:0:0:0 | int 3 |
|
||||
| 4 | file://:0:0:0:0 | int 4 |
|
||||
| 5 | file://:0:0:0:0 | int 5 |
|
||||
| 6 | file://:0:0:0:0 | int 6 |
|
||||
| 7 | file://:0:0:0:0 | int 7 |
|
||||
| 8 | file://:0:0:0:0 | int 8 |
|
||||
| 9 | file://:0:0:0:0 | int 9 |
|
||||
| 10 | file://:0:0:0:0 | int 10 |
|
||||
| 1000 | file://:0:0:0:0 | int 1000 |
|
||||
| 1004 | file://:0:0:0:0 | int 1004 |
|
||||
| b'b' | file://:0:0:0:0 | 'b' |
|
||||
| b'd' | file://:0:0:0:0 | 'd' |
|
||||
| u'a' | file://:0:0:0:0 | 'a' |
|
||||
| u'c' | file://:0:0:0:0 | 'c' |
|
||||
20
python/ql/test/library-tests/PointsTo/api/Constants.ql
Normal file
20
python/ql/test/library-tests/PointsTo/api/Constants.ql
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
import python
|
||||
|
||||
from string txt, Value val
|
||||
where
|
||||
exists(string s |
|
||||
txt = "u'" + s + "'" and val = Value::forUnicode(s)
|
||||
or
|
||||
txt = "b'" + s + "'" and val = Value::forBytes(s)
|
||||
|
|
||||
s = "a" or s = "b" or s = "c" or s = "d"
|
||||
)
|
||||
or
|
||||
exists(int i |
|
||||
txt = i.toString() and val = Value::forInt(i)
|
||||
|
|
||||
i in [1..10] or i in [1000..1010]
|
||||
)
|
||||
|
||||
select txt, val
|
||||
6
python/ql/test/library-tests/PointsTo/api/test.py
Normal file
6
python/ql/test/library-tests/PointsTo/api/test.py
Normal file
@@ -0,0 +1,6 @@
|
||||
u"a"
|
||||
b"b"
|
||||
u"c"
|
||||
b"d"
|
||||
1000
|
||||
1004
|
||||
Reference in New Issue
Block a user