diff tests/test_pymonkey.py @ 123:08a012e96f62

Added another test and fixed a bug it revealed.
author Atul Varma <varmaa@toolness.com>
date Wed, 19 Aug 2009 01:00:35 -0700
parents 5eda03c8e756
children 8371983fee63
line wrap: on
line diff
--- a/tests/test_pymonkey.py	Wed Aug 19 00:47:46 2009 -0700
+++ b/tests/test_pymonkey.py	Wed Aug 19 01:00:35 2009 -0700
@@ -451,6 +451,17 @@
                                         self.last_exception.args[0]),
                          'ReferenceError: hai2u is not defined')
 
+    def testThrowingObjWithBadToStringWorks(self):
+        self.assertRaises(
+            pymonkey.error,
+            self._evaljs,
+            "throw {toString: function() { throw 'dujg' }}"
+            )
+        self.assertEqual(
+            self.last_exception.args[1],
+            "<string conversion failed>"
+            )
+
     def testEvaluateTakesUnicodeCode(self):
         self.assertEqual(self._evaljs(u"'foo\u2026'"),
                          u"foo\u2026")