• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python util.runProgram函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: testAssignChar

 def testAssignChar(self):
     p=util.source('''
         var a = "niNe"
         var b as char= a[2]
         
         print "see N:"
         print b
     ''')
     util.runProgram('TestStringIndexAssign',p)
开发者ID:BackupTheBerlios,项目名称:nine-svn,代码行数:9,代码来源:arraytest.py


示例17: testAssignDelegateExternal

    def testAssignDelegateExternal(self):
        program = util.source('''
            delegate ExternDelegate(arg as System.Double) as System.Double

            var b = ExternDelegate(System.Math.Cos)
            '''
        )

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


示例18: testCodeGen

    def testCodeGen(self):
        program = util.source('''
            var x = 27
            var y = 3
            var z = 'The following line should be "9"'
            print z
            print x / y
        ''')

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


示例19: testAssignDelegateExternalOverloaded

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

            var b = ExternDelegate(System.Convert.ToString)

            print b(9)'''
        )

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


示例20: testAssign

    def testAssign(self):
        program = util.source('''
            var oob as System.Object
            var x = 1
            print x
            oob = 1
            print oob
        ''')

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.source函数代码示例发布时间:2022-05-27
下一篇:
Python util.read_str_as_pandas函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap