diff options
author | Stefan Radomski <github@mintwerk.de> | 2016-12-24 20:10:50 (GMT) |
---|---|---|
committer | Stefan Radomski <github@mintwerk.de> | 2016-12-24 20:10:50 (GMT) |
commit | 1ab8b9a0dcaa131b8cccc735a1794ce39b351715 (patch) | |
tree | 40ed4a202ad8ae5fa100981921ae1b57b220c7e8 /contrib/python | |
parent | 956d81fb50a2717a5b56a9643e87c1db1e2d0661 (diff) | |
download | uscxml-1ab8b9a0dcaa131b8cccc735a1794ce39b351715.zip uscxml-1ab8b9a0dcaa131b8cccc735a1794ce39b351715.tar.gz uscxml-1ab8b9a0dcaa131b8cccc735a1794ce39b351715.tar.bz2 |
Added w3c tests for python bindings
Diffstat (limited to 'contrib/python')
-rw-r--r-- | contrib/python/bindings/test-state-pass.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/contrib/python/bindings/test-state-pass.py b/contrib/python/bindings/test-state-pass.py new file mode 100644 index 0000000..56aba97 --- /dev/null +++ b/contrib/python/bindings/test-state-pass.py @@ -0,0 +1,30 @@ +import sys +import os.path + + +def main(argv): + if not os.path.isfile(argv[1]): + sys.exit(os.EX_NOINPUT) + + # where to find uscxmlNativePython.py? + if os.path.exists('../../../build/cli/lib'): + sys.path.append('../../../build/cli/lib') + if os.environ.get('USCXML_PYTHON_PATH') and os.path.exists(os.environ['USCXML_PYTHON_PATH']): + sys.path.append(os.environ['USCXML_PYTHON_PATH']) + + import uscxmlNativePython as uscxml + + print "Processing" + argv[1] + + interpreter = uscxml.Interpreter.fromURL(argv[1]); + state = interpreter.step() + while state != uscxml.USCXML_FINISHED: + state = interpreter.step() + + if interpreter.isInState("pass"): + sys.exit(os.EX_OK) + + sys.exit(os.EX_OSERR) + +if __name__ == "__main__": + main(sys.argv) |