summaryrefslogtreecommitdiff
path: root/tests/test_clexer.py
diff options
context:
space:
mode:
authorgbrandl <devnull@localhost>2006-10-19 20:27:28 +0200
committergbrandl <devnull@localhost>2006-10-19 20:27:28 +0200
commitf4d019954468db777760d21f9243eca8b852c184 (patch)
tree328b8f8fac25338306b0e7b827686dcc7597df23 /tests/test_clexer.py
downloadpygments-f4d019954468db777760d21f9243eca8b852c184.tar.gz
[svn] Name change, round 4 (rename SVN root folder).
Diffstat (limited to 'tests/test_clexer.py')
-rw-r--r--tests/test_clexer.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/test_clexer.py b/tests/test_clexer.py
new file mode 100644
index 00000000..145c6510
--- /dev/null
+++ b/tests/test_clexer.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+"""
+ Basic CLexer Test
+ ~~~~~~~~~~~~~~~~~
+
+ :copyright: 2006 by Armin Ronacher.
+ :license: GNU GPL, see LICENSE for more details.
+"""
+
+import unittest
+import os
+
+from pygments.token import Text, Number
+from pygments.lexers import CLexer
+
+
+class CLexerTest(unittest.TestCase):
+
+ def setUp(self):
+ self.lexer = CLexer()
+
+ def testNumbers(self):
+ code = '42 23.42 23. .42 023 0xdeadbeef 23e+42 42e-23'
+ wanted = []
+ for item in zip([Number.Integer, Number.Float, Number.Float,
+ Number.Float, Number.Oct, Number.Hex,
+ Number.Float, Number.Float], code.split()):
+ wanted.append(item)
+ wanted.append((Text, ' '))
+ wanted = [(Text, '')] + wanted[:-1] + [(Text, '\n')]
+ self.assertEqual(list(self.lexer.get_tokens(code)), wanted)
+
+
+if __name__ == '__main__':
+ unittest.main(CLexerTest)