changeset 35:6ddc83bb61f8 default tip

added another gc test
author Atul Varma <avarma@mozilla.com>
date Mon, 10 May 2010 21:01:58 -0700
parents 739c87de4667
children
files test_pydertron.py
diffstat 1 files changed, 19 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/test_pydertron.py	Mon May 10 20:57:23 2010 -0700
+++ b/test_pydertron.py	Mon May 10 21:01:58 2010 -0700
@@ -4,6 +4,7 @@
 from StringIO import StringIO
 
 import pydertron
+from pydertron import jsexposed
 
 class PydertronTests(unittest.TestCase):
     def testNullFilesystem(self):
@@ -34,5 +35,23 @@
         gc.collect()
         self.assertEqual(wrt(), None)
 
+    def testGC3(self):
+        sandbox = pydertron.JsSandbox(pydertron.NullFileSystem())
+
+        stuff = []
+
+        @jsexposed
+        def bleh(x):
+            stuff.append(x)
+
+        sandbox.set_globals(bleh=bleh)
+        sandbox.run_script("bleh({});")
+        wrt = weakref.ref(sandbox.rt)
+        sandbox.finish()
+        stuff.pop()
+        del sandbox
+        gc.collect()
+        self.assertEqual(wrt(), None)
+
 if __name__ == '__main__':
     unittest.main()