2 # Copyright (C) 2007, Parrot Foundation.
7 t/oo/proxy.t - Test OO class proxies.
15 Tests OO features related to creating and using class proxies.
20 .include 'test_more.pir'
24 typeof_a_low_level_object()
25 typeof_a_high_level_object()
26 typeof_a_class_object()
27 proxy_as_parent_of_class()
28 proxy_as_parent_of_class_with_new()
29 proxy_no_method_conflict()
30 .local pmc proxy_no_invade
31 proxy_no_invade = get_root_global ['foo'], 'proxy_no_invade'
35 .sub typeof_a_low_level_object
39 $I3 = isa $P1, "PMCProxy"
41 is ($S1, 'String', 'object is typeof string')
42 ok ($I3, 'object isa PMCProxy')
45 .sub typeof_a_high_level_object
50 is ($S1, 'Foo', 'object is typeof Foo')
53 $I3 = isa $P1, "PMCProxy"
54 nok ($I3, 'object not isa PMCProxy')
57 ok ($I3, 'object isa Foo')
60 .sub typeof_a_class_object
63 is ($S1, 'Class', 'object is typeof Class')
66 $I3 = isa $P1, "PMCProxy"
67 ok ($I3, "object isa PMCProxy")
70 .sub proxy_as_parent_of_class
71 $P0 = get_class 'Hash'
72 $P1 = subclass $P0, [ 'MyClass' ]
73 $P2 = new [ 'MyClass' ]
76 is ($S1, 'abc', "retrieve value from subclassed hash")
79 .sub proxy_as_parent_of_class_with_new
80 $P0 = get_class 'Hash'
81 $P1 = subclass $P0, ['Foo';'Bar']
82 $P2 = new ['Foo';'Bar']
84 is ($S0, 'Foo;Bar', 'object is typeof Foo;Bar')
87 .sub proxy_no_method_conflict
92 is($S0, "1+0i", 'Complex method survived')
95 .namespace ['Complex']
96 .sub 'Complex' :method :nsentry('Complex')
104 is = get_root_global ['parrot'], 'is'
108 $P1 = get_root_global ['foo'], 'Sub'
110 if null $P1 goto do_test
113 is($I1, 0, 'No proxy in current HLL namespace, TT #715')
121 # vim: expandtab shiftwidth=4 ft=pir: