2
2
import os
3
3
4
4
sys .path .append (os .path .dirname (os .path .dirname ((__file__ )))) # $ unresolved_call=os.path.dirname(..) unresolved_call=sys.path.append(..)
5
- from testlib import *
5
+ from testlib import expects
6
6
7
7
# These are defined so that we can evaluate the test code.
8
8
NONSOURCE = "not a source"
@@ -53,8 +53,8 @@ def test_indirect_assign():
53
53
def test_indirect_assign_method ():
54
54
myobj = MyObj ("OK" )
55
55
56
- myobj .setFoo (SOURCE ) # $ unresolved_call=myobj.setFoo(..)
57
- SINK (myobj .foo ) # $ MISSING: flow
56
+ myobj .setFoo (SOURCE )
57
+ SINK (myobj .foo ) # $ flow="SOURCE, l:-1 -> myobj.foo"
58
58
59
59
60
60
def test_direct_assign ():
@@ -157,8 +157,8 @@ def test_nested_obj():
157
157
def test_nested_obj_method ():
158
158
x = SOURCE
159
159
a = NestedObj ()
160
- a .getObj ().foo = x # $ unresolved_call=a.getObj()
161
- SINK (a .obj .foo ) # $ MISSING: flow
160
+ a .getObj ().foo = x
161
+ SINK (a .obj .foo ) # $ flow="SOURCE, l:-3 -> a.obj.foo"
162
162
163
163
# ------------------------------------------------------------------------------
164
164
# Global scope
@@ -184,6 +184,22 @@ def test_global_scope():
184
184
# Global flow cases that doesn't work in this file, but works in test_global.py
185
185
# ------------------------------------------------------------------------------
186
186
187
+ # --------------------------------------
188
+ # method calls _before_ those ifs
189
+ # --------------------------------------
190
+
191
+ # def test_indirect_assign_method():
192
+ myobj2 = MyObj ("OK" )
193
+ myobj2 .setFoo (SOURCE )
194
+ SINK (myobj2 .foo ) # $ flow="SOURCE, l:-1 -> myobj2.foo"
195
+
196
+ # def test_nested_obj_method():
197
+ x2 = SOURCE
198
+ a2 = NestedObj ()
199
+ a2 .getObj ().foo = x2
200
+ SINK (a2 .obj .foo ) # $ flow="SOURCE, l:-3 -> a2.obj.foo"
201
+
202
+
187
203
# --------------------------------------
188
204
# using constructor
189
205
# --------------------------------------
@@ -218,7 +234,7 @@ def test_global_scope():
218
234
SINK (fields_with_local_flow (SOURCE )) # $ unresolved_call=fields_with_local_flow(..) unresolved_call=SINK(..) MISSING: flow="SOURCE -> fields_with_local_flow(..)"
219
235
220
236
# --------------------------------------
221
- # method calls
237
+ # method calls _after_ those ifs
222
238
# --------------------------------------
223
239
224
240
# def test_indirect_assign_method():
0 commit comments