diff test_pymonkey.py @ 28:bd30f5c02fc3

Added a new test for supplementary multilingual plane unicode.
author Atul Varma <varmaa@toolness.com>
date Mon, 29 Jun 2009 14:09:01 -0700
parents 21045074139f
children 608d086d12e3
line wrap: on
line diff
--- a/test_pymonkey.py	Mon Jun 29 13:33:07 2009 -0700
+++ b/test_pymonkey.py	Mon Jun 29 14:09:01 2009 -0700
@@ -70,7 +70,15 @@
         retval = self._evaljs("")
         self.assertTrue(retval is pymonkey.undefined)
 
-    def testEvaluateReturnsUnicode(self):
+    def testEvaluateReturnsSMPUnicode(self):
+        # This is 'LINEAR B SYLLABLE B008 A', in the supplementary
+        # multilingual plane (SMP).
+        retval = self._evaljs("'\uD800\uDC00'")
+        self.assertEqual(retval, u'\U00010000')
+        self.assertEqual(retval.encode('utf-16'),
+                         '\xff\xfe\x00\xd8\x00\xdc')
+
+    def testEvaluateReturnsBMPUnicode(self):
         retval = self._evaljs("'o hai\u2026'")
         self.assertTrue(type(retval) == unicode)
         self.assertEqual(retval, u'o hai\u2026')