예제 #1
0
        public void Passthrough()
        {
            PtTest pt = new PtTest();
            Passthrough pter = new Passthrough( pt );

            string program = @"
            pt.test(5, ""bob"", [""1"", ""2""], true, pt)
            pt.property = ""bar""
            a = pt.property
            b = pt.arbitrary
            c = pt.other
            pt.arbitrary = ""new value""
            d = pt.arbitrary
            pt.test2(1, 2, ""3"")

            e = """"
            def func(x):
            e += x

            pt.complex(1, func)
            f = pt.complex(2)
            g = pt.complex(3)
            h = pt.complex(4)
            i = pt.complex(5)
            j = pt.dumpcontext()

            k = 0
            try:
            pt.complex(6)
            except e:
            k = e

            l = 0
            try:
            l = pt.throwme
            except e:
            l = e

            m = 0
            try:
            pt.throwme = ""foo""
            except e:
            m = e

            n = 0
            try:
            pt.callnthrow()
            except e:
            n = e

            ";
            Runner r = new Runner();
            r.pushSecurityContext( new TestSC( "Base Context" ) );
            pter.registerConst( r.state.constScope, "pt" );
            runAndDump( "Passthrough", r, program,
            () => "object dump: {0} {1} {2} {3} {4} {5}\r\n".FormatI(
                dumpObject( pt._a ), dumpObject( pt._b ), dumpObject( pt._c ), dumpObject( pt._d ), dumpObject( pt._e ), dumpObject( pt._f )
            ) );
        }
예제 #2
0
 public void test( int a, string b, string[] c, bool d, PtTest e )
 {
     _a = a;
     _b = b;
     _c = c;
     _d = d;
     _e = e;
     _f = "";
 }