Mercurial > scratch
diff pydershell/pydershell.py @ 22:9413bebf2ee6
Separated the test functionality out into a separate file.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 07 Sep 2009 16:18:34 -0700 |
parents | 1950b0b5bcd8 |
children | 35ab0ad3c294 |
line wrap: on
line diff
--- a/pydershell/pydershell.py Mon Sep 07 15:33:35 2009 -0700 +++ b/pydershell/pydershell.py Mon Sep 07 16:18:34 2009 -0700 @@ -1,5 +1,3 @@ -#! /usr/bin/env python - import sys import time import threading @@ -368,46 +366,3 @@ traceback.print_tb(e.exc_info[2]) print e.exc_info[1] return retval - -if __name__ == '__main__': - sandbox = JsSandbox() - - class Baz(JsExposedObject): - def woozle(self, blap): - return blap + 5 - woozle.__jsexposed__ = True - - def baz(): - return Baz() - sandbox.root.baz = baz - - def bar(obj): - print obj.bar() - sandbox.root.bar = bar - - def foo(callback): - return callback() - sandbox.root.foo = foo - - def ensureBaz(baz): - if not isinstance(baz, Baz): - print "Uhoh" - else: - print "ok" - sandbox.root.ensureBaz = ensureBaz - - def jsprint(string): - print string - sandbox.root['print'] = jsprint - - retval = sandbox.run_script('test.js') - - sandbox.finish() - del sandbox - - import gc - gc.collect() - if pydermonkey.get_debug_info()['runtime_count']: - print "WARNING: JS runtime was not destroyed." - - sys.exit(retval)