Skip to content

Commit d1d898e

Browse files
committed
Python: Add regression test for code that proved problematic with the new parser.
1 parent bc4301f commit d1d898e

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

python/ql/test/library-tests/PointsTo/general/GlobalPointsTo.expected

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
| Class Base2 | 178 | ControlFlowNode for x | int 1 |
77
| Class Derived4 | 182 | ControlFlowNode for FunctionExpr | Function __init__ |
88
| Class Derived4 | 182 | ControlFlowNode for __init__ | Function __init__ |
9+
| Class DiGraph | 272 | ControlFlowNode for FunctionExpr | Function __init__ |
10+
| Class DiGraph | 272 | ControlFlowNode for __init__ | Function __init__ |
11+
| Class DiGraph | 275 | ControlFlowNode for FunctionExpr | Function add_node |
12+
| Class DiGraph | 275 | ControlFlowNode for add_node | Function add_node |
913
| Class E | 195 | ControlFlowNode for FunctionExpr | Function _internal |
1014
| Class E | 195 | ControlFlowNode for _internal | Function _internal |
1115
| Class E | 201 | ControlFlowNode for _internal | Function _internal |
@@ -176,3 +180,6 @@
176180
| Module pointsto_test | 254 | ControlFlowNode for object | builtin-class object |
177181
| Module pointsto_test | 267 | ControlFlowNode for Derived4 | class Derived4 |
178182
| Module pointsto_test | 267 | ControlFlowNode for Derived4() | Derived4() |
183+
| Module pointsto_test | 270 | ControlFlowNode for ClassExpr | class DiGraph |
184+
| Module pointsto_test | 270 | ControlFlowNode for DiGraph | class DiGraph |
185+
| Module pointsto_test | 270 | ControlFlowNode for object | builtin-class object |

python/ql/test/library-tests/PointsTo/general/LocalPointsTo.expected

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,17 @@
339339
| 264 | ControlFlowNode for self | self |
340340
| 267 | ControlFlowNode for Derived4 | class Derived4 |
341341
| 267 | ControlFlowNode for Derived4() | Derived4() |
342+
| 270 | ControlFlowNode for ClassExpr | class DiGraph |
343+
| 270 | ControlFlowNode for DiGraph | class DiGraph |
344+
| 270 | ControlFlowNode for object | builtin-class object |
345+
| 272 | ControlFlowNode for FunctionExpr | Function __init__ |
346+
| 272 | ControlFlowNode for __init__ | Function __init__ |
347+
| 273 | ControlFlowNode for Attribute | Dict |
348+
| 273 | ControlFlowNode for Dict | Dict |
349+
| 273 | ControlFlowNode for self | self |
350+
| 275 | ControlFlowNode for FunctionExpr | Function add_node |
351+
| 275 | ControlFlowNode for add_node | Function add_node |
352+
| 276 | ControlFlowNode for Attribute | Dict |
353+
| 276 | ControlFlowNode for IntegerLiteral | int 0 |
354+
| 276 | ControlFlowNode for Subscript | int 0 |
355+
| 276 | ControlFlowNode for self | self |

python/ql/test/library-tests/PointsTo/general/LocalPointsToType.expected

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,3 +342,17 @@
342342
| 264 | ControlFlowNode for self | self | class G |
343343
| 267 | ControlFlowNode for Derived4 | class Derived4 | builtin-class type |
344344
| 267 | ControlFlowNode for Derived4() | Derived4() | class Derived4 |
345+
| 270 | ControlFlowNode for ClassExpr | class DiGraph | builtin-class type |
346+
| 270 | ControlFlowNode for DiGraph | class DiGraph | builtin-class type |
347+
| 270 | ControlFlowNode for object | builtin-class object | builtin-class type |
348+
| 272 | ControlFlowNode for FunctionExpr | Function __init__ | builtin-class function |
349+
| 272 | ControlFlowNode for __init__ | Function __init__ | builtin-class function |
350+
| 273 | ControlFlowNode for Attribute | Dict | builtin-class dict |
351+
| 273 | ControlFlowNode for Dict | Dict | builtin-class dict |
352+
| 273 | ControlFlowNode for self | self | class DiGraph |
353+
| 275 | ControlFlowNode for FunctionExpr | Function add_node | builtin-class function |
354+
| 275 | ControlFlowNode for add_node | Function add_node | builtin-class function |
355+
| 276 | ControlFlowNode for Attribute | Dict | builtin-class dict |
356+
| 276 | ControlFlowNode for IntegerLiteral | int 0 | builtin-class int |
357+
| 276 | ControlFlowNode for Subscript | int 0 | builtin-class int |
358+
| 276 | ControlFlowNode for self | self | class DiGraph |

python/ql/test/library-tests/PointsTo/general/pointsto_test.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,3 +265,13 @@ def meth(self):
265265

266266
# Self can only be of a class that is instantiated.
267267
Derived4()
268+
269+
270+
class DiGraph(object):
271+
272+
def __init__(self):
273+
self.pred = {}
274+
275+
def add_node(self, n):
276+
self.pred[n] = 0
277+

0 commit comments

Comments
 (0)