diff test_pymonkey.py @ 40:8a7abd0bb48d

Renamed PYM_newJSFunction() to PYM_newJSFunctionFromCallable(). PYM_newJSObject() now returns objects of type PYM_JSFunctionType as needed.
author Atul Varma <varmaa@toolness.com>
date Fri, 03 Jul 2009 20:04:01 -0700
parents d4efcbb06964
children 71ab5e977dd3
line wrap: on
line diff
--- a/test_pymonkey.py	Fri Jul 03 19:40:42 2009 -0700
+++ b/test_pymonkey.py	Fri Jul 03 20:04:01 2009 -0700
@@ -161,6 +161,15 @@
         self.assertTrue(isinstance(obj, pymonkey.Object))
         self.assertEqual(cx.get_property(obj, u"boop"), 1)
 
+    def testEvaluateReturnsFunction(self):
+        rt = pymonkey.Runtime()
+        cx = rt.new_context()
+        obj = cx.new_object()
+        cx.init_standard_classes(obj)
+        obj = cx.evaluate_script(obj, '(function boop() { return 1; })',
+                                 '<string>', 1)
+        self.assertTrue(isinstance(obj, pymonkey.Function))
+
     def testEvaluateReturnsTrue(self):
         self.assertTrue(self._evaljs('true') is True)