当前位置: 首页>>代码示例>>Python>>正文


Python util.runProgram函数代码示例

本文整理汇总了Python中tests.util.runProgram函数的典型用法代码示例。如果您正苦于以下问题:Python runProgram函数的具体用法?Python runProgram怎么用?Python runProgram使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了runProgram函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testEmitCode

    def testEmitCode(self):
        program = util.source('''\
            var x as int
            print x
        ''')

        util.runProgram('variable_test', program, ['mscorlib'])
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:7,代码来源:variabletest.py

示例2: testCallMethod

    def testCallMethod(self):
        program = util.source('''
            var o = TestClass.TestClass()
            o.Method('Hello to C# from Nine!')
        ''')

        util.runProgram('extern_method_test', program, ['bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:externtest.py

示例3: testCreateType

    def testCreateType(self):
        program = util.source('''
            delegate MyDelegate(a as int) as string
            '''
        )

        util.runProgram('delegate_type_test', program, [])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:delegatetest.py

示例4: testCompileString

    def testCompileString(self):
        program = util.source('''
            print 'Expect 9:'
            var count = 0
            if 1<9:
                count = count + 1
            else:
                count = count + 99

            if 1>9:
                pass
            else:
                count = count + 3

            if 1>9:
                pass
            elif 9>1:
                count = count + 4

            if 9<1:
                pass
            elif 9<1:
                pass
            else:
                count = count + 1

            print count

            if count == 9:
                print 'Looks like it passed.  Woohoo!'
            else:
                print 'Oh no it failed!!' ''')

        util.runProgram('if_test',program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:34,代码来源:iftest.py

示例5: testCodeGen

    def testCodeGen(self):
        program = util.source('''
            var a = -9
            var b = -3.1415926535897931
            var c = +9
            var d = -c
            var e = ~0
            var f = ~(~1)

            print a
            print b
            print c
            print d
            print e
            print f

            var t1 = true
            var f1 = false
            var f2 = not t1
            var t2 = not f2
            var t3 = not f1

            print ''
            print 'Expect True, False, False, True, True'
            print t1
            print f1
            print f2
            print t2
            print t3
        ''')

        util.runProgram('unary_codegen_test', program)
开发者ID:andyfriesen,项目名称:nine,代码行数:32,代码来源:unarytest.py

示例6: testReadAttribute

    def testReadAttribute(self):
        program = util.source('''
            var o = TestClass.TestClass()
            print o.x
        ''')

        util.runProgram('extern_read_attr_test', program, ['bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:externtest.py

示例7: testTypes

 def testTypes(self):
     util.runProgram('print_types', util.source('''
         print (27 as int)
         print (27 as float)
         print (27 as System.Double)
         print (true as boolean)
     '''), ['mscorlib'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:printtest.py

示例8: testReadProperty

    def testReadProperty(self):
        program = util.source('''
            var o = TestClass.TestClass(2)
            print o.Property
        ''')

        util.runProgram('extern_read_property_test', program, ['mscorlib', 'bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:7,代码来源:externtest.py

示例9: testWriteAttribute

    def testWriteAttribute(self):
        program = util.source('''
            var o = TestClass.TestClass()
            o.x = 999
            print o.x
        ''')

        util.runProgram('extern_write_attr_test', program, ['bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:8,代码来源:externtest.py

示例10: testCallValueTypeMember

    def testCallValueTypeMember(self):
        program = util.source('''
            var pi = 3.1415926535897931
            print 'Pi:'
            print pi.ToString()
        ''')

        util.runProgram('extern_call_value_type_member_test', program)
开发者ID:andyfriesen,项目名称:nine,代码行数:8,代码来源:externtest.py

示例11: testWriteProperty

    def testWriteProperty(self):
        program = util.source('''
            var o = TestClass.TestClass(2)
            o.Property = 'Nine!'
            print o.Property
        ''')

        util.runProgram('extern_write_property_test', program, ['mscorlib', 'bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:8,代码来源:externtest.py

示例12: testResolveOverload

    def testResolveOverload(self):
        program = util.source('''
            var o = TestClass.TestClass(2)
            o.Method(9)
            #o.Method('String!')
        ''')

        util.runProgram('extern_overload_test', program, ['mscorlib', 'bin/ClassLibrary1'])
开发者ID:andyfriesen,项目名称:nine,代码行数:8,代码来源:externtest.py

示例13: testIndexValueTypeMethod

    def testIndexValueTypeMethod(self):
        program = util.source('''
            var things = array(int, 1)

            print things[0].ToString()
        ''')

        util.runProgram('array_index_value_type_method_test', program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:8,代码来源:arraytest.py

示例14: testCompileString

 def testCompileString(self):
     program = util.source('''
         class Foo:
             def ctor(a as string):
                 print a
                 
         var b as Foo = Foo("Constructor works!")'''
     )
     util.runProgram("ctor_test", program, [])
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:9,代码来源:ctortest.py

示例15: testCompileString

    def testCompileString(self):
        program = '''\
print 'ADD'
print 3 + 6
print 'SUB'
print 12 - 3
'''

        util.runProgram('printadd_test', program)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:9,代码来源:printaddtest.py


注:本文中的tests.util.runProgram函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。