Files
codeql/swift/tools/test/qltest/extractor_env/test.py
Paolo Tranquilli 3acd4486a3 Swift: add tests for RUN_UNDER support
While I would have preferred to add a proper unit test, this required
more infrastructure for mocking system calls. Instead I made `qltest.sh`
accept a `//codeql-extractor-env` header and used that to write a QL
test exercising the `RUN_UNDER` functionality.
2022-11-02 12:09:13 +01:00

17 lines
342 B
Python

from swift.tools.test.qltest.utils import *
set_dummy_extractor('''
set -x
if [[ " $@ " =~ a.swift ]]; then
[[ "$VAR1" == "foo" && "$VAR2" == "" ]] || exit 1
elif [[ " $@ " =~ b.swift ]]; then
[[ "$VAR1" == "bar" && "$VAR2" == "baz" ]] || exit 1
fi
''')
run_qltest()
assert_extractor_executed_with(
"a.swift",
"b.swift",
)