diff options
author | Jeffrey B. Arnold <jeffrey.arnold@gmail.com> | 2012-09-01 15:45:51 -0400 |
---|---|---|
committer | Jeffrey B. Arnold <jeffrey.arnold@gmail.com> | 2012-09-01 15:45:51 -0400 |
commit | 2645ed16565af188959633c17638acf91395a6a3 (patch) | |
tree | 9176fb77ac48cd95492e495ce59a2e8ae583e8b5 /tests/test_util.py | |
parent | aa10b337c917219367b3b29f7dc4157e1f45b292 (diff) | |
parent | fe187b72911c8a1c653c2d81690a1ec47f13fa77 (diff) | |
download | pygments-2645ed16565af188959633c17638acf91395a6a3.tar.gz |
merged
Diffstat (limited to 'tests/test_util.py')
-rw-r--r-- | tests/test_util.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py index 6b931eb2..be1662f9 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -7,6 +7,7 @@ :license: BSD, see LICENSE for details. """ +import re import unittest from pygments import util @@ -114,3 +115,20 @@ class UtilTest(unittest.TestCase): '<?xml ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN">')) self.assertTrue(util.looks_like_xml('<html xmlns>abc</html>')) self.assertFalse(util.looks_like_xml('<html>')) + + def test_unirange(self): + first_non_bmp = u'\U00010000' + r = re.compile(util.unirange(0x10000, 0x20000)) + m = r.match(first_non_bmp) + self.assertTrue(m) + self.assertEquals(m.end(), len(first_non_bmp)) + self.assertFalse(r.match(u'\uffff')) + self.assertFalse(r.match(u'xxx')) + # Tests that end is inclusive + r = re.compile(util.unirange(0x10000, 0x10000) + '+') + # Tests that the plus works for the entire unicode point, if narrow + # build + m = r.match(first_non_bmp * 2) + self.assertTrue(m) + self.assertEquals(m.end(), len(first_non_bmp) * 2) + |