mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
39 lines
1.2 KiB
Python
Executable File
39 lines
1.2 KiB
Python
Executable File
#!/usr/bin/python
|
|
#
|
|
# Narcissus 'shell' for use with jstests.py
|
|
# This must be run from the js/tests directory
|
|
|
|
import os, re, sys
|
|
from subprocess import *
|
|
from optparse import OptionParser
|
|
|
|
js_cmd="../js"
|
|
NARC_JS_DIR = "../../narcissus/"
|
|
narc_jsdefs = NARC_JS_DIR + "jsdefs.js"
|
|
narc_jslex = NARC_JS_DIR + "jslex.js"
|
|
narc_jsparse = NARC_JS_DIR + "jsparse.js"
|
|
narc_jsexec = NARC_JS_DIR + "jsexec.js"
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
op = OptionParser(usage='%prog [TEST-SPECS]')
|
|
op.add_option('-f', '--file', dest='js_files', action='append',
|
|
help='JS file to load', metavar='FILE')
|
|
op.add_option('-e', '--expression', dest='js_exps', action='append',
|
|
help='JS expression to evaluate')
|
|
|
|
(options, args) = op.parse_args()
|
|
|
|
cmd = 'evaluate("__NARCISSUS__=true;"); '
|
|
if options.js_exps:
|
|
for exp in options.js_exps:
|
|
cmd += 'evaluate("%s"); ' % exp.replace('"', '\\"')
|
|
|
|
if options.js_files:
|
|
for file in options.js_files:
|
|
cmd += 'evaluate(snarf("%(file)s"), "%(file)s", 1); ' % {'file':file }
|
|
|
|
Popen([js_cmd, '-f', narc_jsdefs, '-f', narc_jslex, '-f', narc_jsparse, '-f', narc_jsexec, '-e', cmd]).wait()
|
|
|