Mercurial > pymonkey
diff test_pymonkey.py @ 76:4cb89d48b068
Added test for infinite recursion.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Fri, 07 Aug 2009 11:02:56 -0700 |
parents | 4b1149d818e8 |
children | 755af0a94c94 |
line wrap: on
line diff
--- 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(); })();', '<string>', 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()