Skip to content

Commit 63b2bd0

Browse files
committed
Python: Fixup test_only_starargs addition
validTest.py did not pass, since we use `SINK3_F`. I initially tried swapping the order ``` args = (arg1, arg2) # $ arg1 arg2 func=starargs_only more_args = (arg4, arg3) starargs_only(*args, *more_args) ``` But then asked myself, what is it _actually_ we're testing here? and it seems to be the way we handle multiple *args arguments in the same call, so I converted the test to be that instead! (and it matches what we do in test_stararg_mixed)
1 parent 0879c8f commit 63b2bd0

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

python/ql/test/experimental/dataflow/coverage/argumentPassing.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def starargs_only(*args):
207207
SINK2(args[1])
208208
SINK3_F(args[2])
209209

210-
@expects(3*3)
210+
@expects(5*3)
211211
def test_only_starargs():
212212
starargs_only(arg1, arg2, "safe") # $ arg1 arg2 SPURIOUS: bad2,bad3="arg1" bad1,bad3="arg2"
213213

@@ -217,9 +217,12 @@ def test_only_starargs():
217217
args = (arg1, arg2, "safe") # $ arg1 arg2 func=starargs_only
218218
starargs_only(*args)
219219

220-
args = (arg1, arg2) # $ arg1 arg2 func=starargs_only
221-
more_args = (arg3, arg4)
222-
starargs_only(*args, *more_args)
220+
empty_args = ()
221+
222+
args = (arg1, arg2, "safe") # $ arg1 arg2 func=starargs_only
223+
starargs_only(*args, *empty_args)
224+
args = (arg1, arg2, "safe") # $ MISSING: arg1 arg2 func=starargs_only
225+
starargs_only(*empty_args, *args)
223226

224227

225228
def starargs_mixed(a, *args):

0 commit comments

Comments
 (0)