-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_swift.py
executable file
·43 lines (33 loc) · 1.07 KB
/
test_swift.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env python3
from os.path import dirname, realpath
import sys
from test import JAVA_SUITES, INTERPRETERS, run_suites, run_suite
import test
test.REPO_DIR = dirname(realpath(__file__))
SWIFT_SUITES = JAVA_SUITES
def java_to_swift_interpreter(interpreter):
if interpreter.language == 'java':
# interpreter.language = 'swift'
interpreter.args = ['.build/debug/slox']
return interpreter
INTERPRETERS = {name: java_to_swift_interpreter(interpreter) for (name, interpreter) in INTERPRETERS.items()}
def main():
if len(sys.argv) < 2 or len(sys.argv) > 3:
print('Usage: test.py <interpreter> [filter]')
sys.exit(1)
if len(sys.argv) == 3:
filter_path = sys.argv[2]
if sys.argv[1] == 'all':
run_suites(sorted(INTERPRETERS.keys()))
elif sys.argv[1] == 'c':
run_suites(C_SUITES)
elif sys.argv[1] == 'swift':
run_suites(SWIFT_SUITES)
elif sys.argv[1] not in INTERPRETERS:
print('Unknown interpreter "{}"'.format(sys.argv[1]))
sys.exit(1)
else:
if not run_suite(sys.argv[1]):
sys.exit(1)
if __name__ == '__main__':
main()