py: Inline expectation should have space before $

This commit is contained in:
Owen Mansel-Chan
2026-03-04 12:09:22 +00:00
parent ea30f02271
commit 91b6801db1
69 changed files with 891 additions and 892 deletions

View File

@@ -33,7 +33,7 @@ def SINK_F(x):
def by_value1():
a = SOURCE
def inner(a_val=a):
SINK(a_val) #$ captured
SINK(a_val) # $ captured
SINK_F(a)
a = NONSOURCE
inner()
@@ -41,7 +41,7 @@ def by_value1():
def by_value2():
a = NONSOURCE
def inner(a_val=a):
SINK(a) #$ captured
SINK(a) # $ captured
SINK_F(a_val)
a = SOURCE
inner()

View File

@@ -37,7 +37,7 @@ def out():
def captureOut1():
sinkO1["x"] = SOURCE
captureOut1()
SINK(sinkO1["x"]) #$ captured
SINK(sinkO1["x"]) # $ captured
sinkO2 = { "x": "" }
def captureOut2():
@@ -45,7 +45,7 @@ def out():
sinkO2["x"] = SOURCE
m()
captureOut2()
SINK(sinkO2["x"]) #$ captured
SINK(sinkO2["x"]) # $ captured
nonSink0 = { "x": "" }
def captureOut1NotCalled():
@@ -67,7 +67,7 @@ def through(tainted):
def captureOut1():
sinkO1["x"] = tainted
captureOut1()
SINK(sinkO1["x"]) #$ captured
SINK(sinkO1["x"]) # $ captured
sinkO2 = { "x": "" }
def captureOut2():
@@ -75,7 +75,7 @@ def through(tainted):
sinkO2["x"] = tainted
m()
captureOut2()
SINK(sinkO2["x"]) #$ captured
SINK(sinkO2["x"]) # $ captured
nonSink1 = { "x": "" }
def captureOut1NotCalled():

View File

@@ -42,7 +42,7 @@ def out():
global sinkO1
sinkO1 = SOURCE
captureOut1()
SINK(sinkO1) #$ captured
SINK(sinkO1) # $ captured
def captureOut2():
def m():
@@ -50,12 +50,12 @@ def out():
sinkO2 = SOURCE
m()
captureOut2()
SINK(sinkO2) #$ captured
SINK(sinkO2) # $ captured
def captureOut1NotCalled():
global nonSink1
nonSink1 = SOURCE
SINK_F(nonSink1) #$ SPURIOUS: captured
SINK_F(nonSink1) # $ SPURIOUS: captured
def captureOut2NotCalled():
# notice that `m` is not called
@@ -63,7 +63,7 @@ def out():
global nonSink2
nonSink2 = SOURCE
captureOut2NotCalled()
SINK_F(nonSink2) #$ SPURIOUS: captured
SINK_F(nonSink2) # $ SPURIOUS: captured
@expects(4)
def test_out():
@@ -78,7 +78,7 @@ def through(tainted):
global sinkT1
sinkT1 = tainted
captureOut1()
SINK(sinkT1) #$ captured
SINK(sinkT1) # $ captured
def captureOut2():
def m():
@@ -86,7 +86,7 @@ def through(tainted):
sinkT2 = tainted
m()
captureOut2()
SINK(sinkT2) #$ captured
SINK(sinkT2) # $ captured
def captureOut1NotCalled():
global nonSinkT1

View File

@@ -34,17 +34,17 @@ def SINK_F(x):
def inParam(tainted):
def captureIn1():
sinkI1 = tainted
SINK(sinkI1) #$ captured
SINK(sinkI1) # $ captured
captureIn1()
def captureIn2():
def m():
sinkI2 = tainted
SINK(sinkI2) #$ captured
SINK(sinkI2) # $ captured
m()
captureIn2()
captureIn3 = lambda arg: SINK(tainted) #$ captured
captureIn3 = lambda arg: SINK(tainted) # $ captured
captureIn3("")
def captureIn1NotCalled():
@@ -68,17 +68,17 @@ def inLocal():
def captureIn1():
sinkI1 = tainted
SINK(sinkI1) #$ captured
SINK(sinkI1) # $ captured
captureIn1()
def captureIn2():
def m():
sinkI2 = tainted
SINK(sinkI2) #$ captured
SINK(sinkI2) # $ captured
m()
captureIn2()
captureIn3 = lambda arg: SINK(tainted) #$ captured
captureIn3 = lambda arg: SINK(tainted) # $ captured
captureIn3("")
def captureIn1NotCalled():

View File

@@ -38,7 +38,7 @@ def out():
nonlocal sinkO1
sinkO1 = SOURCE
captureOut1()
SINK(sinkO1) #$ captured
SINK(sinkO1) # $ captured
sinkO2 = ""
def captureOut2():
@@ -47,7 +47,7 @@ def out():
sinkO2 = SOURCE
m()
captureOut2()
SINK(sinkO2) #$ captured
SINK(sinkO2) # $ captured
nonSink1 = ""
def captureOut1NotCalled():
@@ -74,7 +74,7 @@ def through(tainted):
nonlocal sinkO1
sinkO1 = tainted
captureOut1()
SINK(sinkO1) #$ captured
SINK(sinkO1) # $ captured
sinkO2 = ""
def captureOut2():
@@ -83,7 +83,7 @@ def through(tainted):
sinkO2 = tainted
m()
captureOut2()
SINK(sinkO2) #$ captured
SINK(sinkO2) # $ captured
nonSink1 = ""
def captureOut1NotCalled():

View File

@@ -34,16 +34,16 @@ l = [NONSOURCE]
SINK_F(l[0])
l_mod = [SOURCE for x in l]
SINK(l_mod[0]) #$ captured
SINK(l_mod[0]) # $ captured
l_mod_lambda = [(lambda a : SOURCE)(x) for x in l]
SINK(l_mod_lambda[0]) #$ captured
SINK(l_mod_lambda[0]) # $ captured
def mod(x):
return SOURCE
l_mod_function = [mod(x) for x in l]
SINK(l_mod_function[0]) #$ captured
SINK(l_mod_function[0]) # $ captured
def mod_list(l):
def mod_local(x):
@@ -52,7 +52,7 @@ def mod_list(l):
return [mod_local(x) for x in l]
l_modded = mod_list(l)
SINK(l_modded[0]) #$ captured
SINK(l_modded[0]) # $ captured
def mod_list_first(l):
def mod_local(x):
@@ -61,4 +61,4 @@ def mod_list_first(l):
return [mod_local(l[0])]
l_modded_first = mod_list_first(l)
SINK(l_modded_first[0]) #$ captured
SINK(l_modded_first[0]) # $ captured

View File

@@ -38,7 +38,7 @@ def test_captured_field():
foo.setFoo(NONSOURCE)
def test():
SINK(foo.getFoo()) #$ captured
SINK(foo.getFoo()) # $ captured
def read():
return foo.getFoo()
@@ -48,4 +48,4 @@ def test_captured_field():
foo.setFoo(SOURCE)
test()
SINK(read()) #$ captured
SINK(read()) # $ captured

View File

@@ -45,4 +45,4 @@ def test_library_call():
for x in map(set, [1]):
pass
SINK(captured["x"]) #$ captured
SINK(captured["x"]) # $ captured