mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
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.
17 lines
342 B
Python
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",
|
|
)
|