22import os
33
44sys .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
66
77# These are defined so that we can evaluate the test code.
88NONSOURCE = "not a source"
@@ -53,8 +53,8 @@ def test_indirect_assign():
5353def test_indirect_assign_method ():
5454 myobj = MyObj ("OK" )
5555
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"
5858
5959
6060def test_direct_assign ():
@@ -157,8 +157,8 @@ def test_nested_obj():
157157def test_nested_obj_method ():
158158 x = SOURCE
159159 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"
162162
163163# ------------------------------------------------------------------------------
164164# Global scope
@@ -184,6 +184,22 @@ def test_global_scope():
184184# Global flow cases that doesn't work in this file, but works in test_global.py
185185# ------------------------------------------------------------------------------
186186
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+
187203# --------------------------------------
188204# using constructor
189205# --------------------------------------
@@ -218,7 +234,7 @@ def test_global_scope():
218234SINK (fields_with_local_flow (SOURCE )) # $ unresolved_call=fields_with_local_flow(..) unresolved_call=SINK(..) MISSING: flow="SOURCE -> fields_with_local_flow(..)"
219235
220236# --------------------------------------
221- # method calls
237+ # method calls _after_ those ifs
222238# --------------------------------------
223239
224240# def test_indirect_assign_method():
0 commit comments