comparison 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
comparison
equal deleted inserted replaced
122:5eda03c8e756 123:08a012e96f62
449 obj, 'hai2u()', '<string>', 1) 449 obj, 'hai2u()', '<string>', 1)
450 self.assertEqual(self._tostring(cx, 450 self.assertEqual(self._tostring(cx,
451 self.last_exception.args[0]), 451 self.last_exception.args[0]),
452 'ReferenceError: hai2u is not defined') 452 'ReferenceError: hai2u is not defined')
453 453
454 def testThrowingObjWithBadToStringWorks(self):
455 self.assertRaises(
456 pymonkey.error,
457 self._evaljs,
458 "throw {toString: function() { throw 'dujg' }}"
459 )
460 self.assertEqual(
461 self.last_exception.args[1],
462 "<string conversion failed>"
463 )
464
454 def testEvaluateTakesUnicodeCode(self): 465 def testEvaluateTakesUnicodeCode(self):
455 self.assertEqual(self._evaljs(u"'foo\u2026'"), 466 self.assertEqual(self._evaljs(u"'foo\u2026'"),
456 u"foo\u2026") 467 u"foo\u2026")
457 468
458 def testEvaluateReturnsUndefined(self): 469 def testEvaluateReturnsUndefined(self):