2 # Copyright (C) 2007-2010, Parrot Foundation.
7 t/oo/methods.t - Test OO methods
11 % prove t/oo/methods.t
15 Tests features related to the creation, addition, and execution of OO methods.
19 .const string library_file = "method_library.pir"
22 .include 'test_more.pir'
28 loading_methods_from_file()
29 loading_methods_from_eval()
30 overridden_find_method()
41 file = new ['FileHandle']
42 file.'open'(library_file, 'w')
46 .sub 'bar_method' :method
56 .sub try_delete_library
65 $S1 = concat "WARNING: could not delete test file `", library_file
66 $S1 = concat $S1, "' because the OS PMC is unavailable"
70 .sub loading_methods_from_file
73 $I0 = $P1.'foo_method'()
74 ok ($I0, 'calling foo_method')
76 load_bytecode library_file
78 $I0 = $P1.'bar_method'()
79 ok ($I0, 'calling bar_method')
84 .sub 'foo_method' :method
89 .sub loading_methods_from_eval
93 $I0 = $P1.'foo_method'()
94 ok ($I0, 'calling foo_method')
98 .sub 'bar_method' :method
106 $I0 = $P1.'bar_method'()
107 ok ($I0, 'calling bar_method')
111 .sub 'foo_method' :method
116 .sub overridden_find_method
119 $I0 = $P2.'some_method'(42)
120 is ($I0, 42, 'calling overriden method')
130 .sub 'find_method' :vtable :method
131 .param string meth_name
133 .const 'Sub' meth = 'meth'
139 .sub 'overridden_core_pmc'
141 msg = "able to invoke overridden method on core PMC (TT #1596)"
142 $P0 = new 'ResizablePMCArray'
148 .namespace ['ResizablePMCArray']
157 # vim: expandtab shiftwidth=4 ft=pir: