You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
790 B

import antlr3
import testbase
import unittest
import os
import sys
from io import StringIO
class t018llstar(testbase.ANTLRTest):
def setUp(self):
self.compileGrammar()
def testValid(self):
inputPath = os.path.splitext(__file__)[0] + '.input'
with open(inputPath) as f:
cStream = antlr3.StringStream(f.read())
lexer = self.getLexer(cStream)
tStream = antlr3.CommonTokenStream(lexer)
parser = self.getParser(tStream)
parser.program()
output = parser.output.getvalue()
outputPath = os.path.splitext(__file__)[0] + '.output'
with open(outputPath) as f:
testOutput = f.read()
self.assertEqual(output, testOutput)
if __name__ == '__main__':
unittest.main()