2 # Copyright (C) 2007-2010, Parrot Foundation.
7 t/oo/root_new.t - Test OO instantiation via root_new
11 % prove t/oo/root_new.t
15 Tests OO features related to instantiating new objects
16 via the C<root_new> opcode.
21 .include 'except_types.pasm'
22 .include 'test_more.pir'
25 instantiate_from_key_pmc()
26 .const 'Sub' test2 = 'instantiate_from_key_pmc_in_foreign_hll'
38 # Set up local variables
40 .local string class_name
43 $P0 = split ' ', in_str
51 if $I0 == 0 goto BEGIN_TEST
56 concat class_name, ';'
57 concat class_name, $S1
63 .local string typeof_message
64 typeof_message = concat 'New instance is of type: ', class_name
66 is($S1, class_name, typeof_message)
68 .local string keypmc_message
69 $S2 = get_repr key_pmc
70 keypmc_message = concat 'The object isa ', $S2
71 $I2 = isa obj, key_pmc
72 ok($I2, keypmc_message)
74 unless $I1 == 1 goto END_TEST
75 isa_ok(obj, class_name)
82 #############################################################################
84 .sub instantiate_from_key_pmc
85 $P0 = root_new ['parrot';'Integer']
86 _test_instance($P0, 'Integer')
91 .sub instantiate_from_key_pmc_in_foreign_hll
92 $P0 = root_new ['parrot';'Integer']
93 _test_instance($P0, 'Integer')
101 # vim: expandtab shiftwidth=4 ft=pir: