Home | History | Annotate | Download | only in tests
      1 import antlr3
      2 import testbase
      3 import unittest
      4 
      5 
      6 class t041parameters(testbase.ANTLRTest):
      7     def setUp(self):
      8         self.compileGrammar()
      9         
     10 
     11     def lexerClass(self, base):
     12         class TLexer(base):
     13             def recover(self, input, re):
     14                 # no error recovery yet, just crash!
     15                 raise
     16 
     17         return TLexer
     18     
     19         
     20     def parserClass(self, base):
     21         class TParser(base):
     22             def recover(self, input, re):
     23                 # no error recovery yet, just crash!
     24                 raise
     25 
     26         return TParser
     27     
     28         
     29     def testValid1(self):
     30         cStream = antlr3.StringStream('a a a')
     31 
     32         lexer = self.getLexer(cStream)
     33         tStream = antlr3.CommonTokenStream(lexer)
     34         parser = self.getParser(tStream)
     35         r = parser.a('foo', 'bar')
     36 
     37         assert r == ('foo', 'bar'), r
     38 
     39 
     40 if __name__ == '__main__':
     41     unittest.main()
     42 
     43 
     44 
     45 
     46