Exemplo n.º 1
0
    def testParse3(self):
        program = util.source('''
            class NineTest:
                var memberVar
        ''')

        result = util.parseProgram(program)
        assert isinstance(result[0], ClassDecl)
        return result[0]
Exemplo n.º 2
0
    def testParse2(self):
        program = util.source('''
            class NineTest:
                def Method():
                    pass
        ''')

        result = util.parseProgram(program)
        assert isinstance(result[0], ClassDecl)
        return result[0]
Exemplo n.º 3
0
    def testParse1(self):
        'Return the ClassDecl so that the testSemanticX methods can use it.'
        program = util.source('''
            class NineTest:
                pass
        ''')

        result = util.parseProgram(program)
        assert isinstance(result[0], ClassDecl)
        return result[0]
Exemplo n.º 4
0
    def testGetMethods(self):
        'testGetMethods: ClassDecl.getMethods'
        program = util.source('''
            class AClass:
                def a():
                    pass

                def b():
                    pass

                var c

                def d():
                    pass

                virtual def e():
                    pass
        ''')

        decl = util.parseProgram(program).pop()
        assert isinstance(decl, ClassDecl)

        names = [func.name for func in decl.getMethods()]
        self.assertEqual(names, ['a', 'b', 'd', 'e'])