Home | History | Annotate | Download | only in tests
      1 import antlr3
      2 import testbase
      3 import unittest
      4 import os
      5 import sys
      6 from io import StringIO
      7 
      8 class t018llstar(testbase.ANTLRTest):
      9     def setUp(self):
     10         self.compileGrammar()
     11         
     12 
     13     def testValid(self):
     14         inputPath = os.path.splitext(__file__)[0] + '.input'
     15         with open(inputPath) as f:
     16             cStream = antlr3.StringStream(f.read())
     17         lexer = self.getLexer(cStream)
     18         tStream = antlr3.CommonTokenStream(lexer)
     19         parser = self.getParser(tStream)
     20         parser.program()
     21 
     22         output = parser.output.getvalue()
     23 
     24         outputPath = os.path.splitext(__file__)[0] + '.output'
     25         with open(outputPath) as f:
     26             testOutput = f.read()
     27 
     28         self.assertEqual(output, testOutput)
     29 
     30 if __name__ == '__main__':
     31     unittest.main()
     32