Mercurial > pymonkey
diff test_pymonkey.py @ 92:d2891ca1b89c
Added tests involving unicode with embedded NUL characters.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sat, 15 Aug 2009 00:20:03 -0700 |
parents | e77bc7c799e8 |
children | c66d7da09c95 |
line wrap: on
line diff
--- a/test_pymonkey.py Sat Aug 15 00:10:29 2009 -0700 +++ b/test_pymonkey.py Sat Aug 15 00:20:03 2009 -0700 @@ -238,6 +238,13 @@ self.assertEqual(funcArgs[1][0], 1) self.assertEqual(funcArgs[1][1], u'foo') + def testJsWrappedPythonFunctionReturnsUnicodeWithEmbeddedNULs(self): + def hai2u(cx, this, args): + return args[0] + u"o hai" + self.assertEqual(self._evalJsWrappedPyFunc(hai2u, + 'hai2u("blah\x00 ")'), + u"blah\x00 o hai") + def testJsWrappedPythonFunctionReturnsUnicode(self): def hai2u(cx, this, args): return u"o hai" @@ -426,6 +433,10 @@ retval = self._evaljs("") self.assertTrue(retval is pymonkey.undefined) + def testEvaludateReturnsUnicodeWithEmbeddedNULs(self): + retval = self._evaljs("'\x00hi'") + self.assertEqual(retval, u'\x00hi') + def testEvaluateReturnsSMPUnicode(self): # This is 'LINEAR B SYLLABLE B008 A', in the supplementary # multilingual plane (SMP).