• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import antlr3
2import testbase
3import unittest
4import os
5import sys
6from io import StringIO
7
8class 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
30if __name__ == '__main__':
31    unittest.main()
32