mirror of
https://github.com/github/codeql.git
synced 2026-04-26 09:15:12 +02:00
Add tests
This commit is contained in:
@@ -85,6 +85,27 @@ def test_in_local_variable():
|
||||
else:
|
||||
ensure_tainted(ts) # $ tainted
|
||||
|
||||
def test_is_none():
|
||||
ts = TAINTED_STRING
|
||||
if ts is None:
|
||||
ensure_not_tainted(ts)
|
||||
else:
|
||||
ensure_tainted(ts) # $ tainted
|
||||
|
||||
def test_is_not_none():
|
||||
ts = TAINTED_STRING
|
||||
if ts is not None:
|
||||
ensure_tainted(ts) # $ tainted
|
||||
else:
|
||||
ensure_not_tainted(ts)
|
||||
|
||||
def test_in_list_with_constants():
|
||||
ts = TAINTED_STRING
|
||||
if ts in ["safe", None, 3, False]:
|
||||
ensure_not_tainted(ts)
|
||||
else:
|
||||
ensure_tainted(ts) # $ tainted
|
||||
|
||||
|
||||
SAFE = ["safe", "also_safe"]
|
||||
|
||||
@@ -184,6 +205,9 @@ test_in_tuple()
|
||||
test_in_set()
|
||||
test_in_local_variable()
|
||||
test_in_global_variable()
|
||||
test_is_none()
|
||||
test_is_not_none()
|
||||
test_in_list_with_constants()
|
||||
make_modification("unsafe")
|
||||
test_in_modified_global_variable()
|
||||
test_in_unsafe1(["unsafe", "foo"])
|
||||
Reference in New Issue
Block a user