diff python/testc3.py @ 204:de3a68f677a5

Added long comment to c3 parser
author Windel Bouwman
date Fri, 21 Jun 2013 15:01:08 +0200
parents b01429a5d695
children d77cb5962cc5
line wrap: on
line diff
--- a/python/testc3.py	Sat Jun 15 19:13:05 2013 +0200
+++ b/python/testc3.py	Fri Jun 21 15:01:08 2013 +0200
@@ -100,7 +100,26 @@
    diag = ppci.DiagnosticsManager()
    c3compile(testsrc, diag)
 
-class testA(unittest.TestCase):
+class testLexer(unittest.TestCase):
+    def testBlockComment(self):
+        snippet = """
+          /* Demo */
+          var int x = 0;
+        """
+        toks = ['var', 'ID', 'ID', '=', 'NUMBER', ';', 'END']
+        self.assertSequenceEqual([tok.typ for tok in c3.lexer.tokenize(snippet)], toks)
+    def testBlockCommentMultiLine(self):
+        snippet = """
+          /* Demo
+          bla1
+          bla2
+          */
+          var int x = 0;
+        """
+        toks = ['var', 'ID', 'ID', '=', 'NUMBER', ';', 'END']
+        self.assertSequenceEqual([tok.typ for tok in c3.lexer.tokenize(snippet)], toks)
+
+class testBuilder(unittest.TestCase):
    def setUp(self):
       self.diag = ppci.DiagnosticsManager()
       self.builder = c3.Builder(self.diag)