# HG changeset patch # User Atul Varma # Date 1249668176 25200 # Node ID 4cb89d48b06874ea18d1dbf8ef656dfad428e7b0 # Parent 4b1149d818e8e4e92359b131738f2335fb2f68ff Added test for infinite recursion. diff -r 4b1149d818e8 -r 4cb89d48b068 test_pymonkey.py --- a/test_pymonkey.py Thu Jul 30 21:50:10 2009 -0700 +++ b/test_pymonkey.py Fri Aug 07 11:02:56 2009 -0700 @@ -274,6 +274,20 @@ u"foo") self.assertEqual(self.last_exception.message, u"blah") + def testInfiniteRecursionRaisesError(self): + cx = pymonkey.Runtime().new_context() + obj = cx.new_object() + cx.init_standard_classes(obj) + self.assertRaises( + pymonkey.error, + cx.evaluate_script, + obj, '(function foo() { foo(); })();', '', 1 + ) + self.assertEqual( + self._tostring(cx, self.last_exception.message), + "InternalError: too much recursion" + ) + def testObjectGetattrWorks(self): cx = pymonkey.Runtime().new_context() obj = cx.new_object()