comparison paraspace/tests/injection_test.py @ 110:6380730a80b4

Add collect_typeidxs_mentioned_by_class()
author Thinker K.F. Li <thinker@codemud.net>
date Mon, 01 Aug 2011 15:00:29 +0800
parents 835336632aba
children 3820379b34e8
comparison
equal deleted inserted replaced
109:835336632aba 110:6380730a80b4
175 175
176 176
177 def collect_types_in_method_test(): 177 def collect_types_in_method_test():
178 from paraspace.dex_deptracker import prepare_dep_decls 178 from paraspace.dex_deptracker import prepare_dep_decls
179 from paraspace.injection import collect_typeidxs_in_method 179 from paraspace.injection import collect_typeidxs_in_method
180 from paraspace.injection import collect_typeidxs_mentioned_by_class
181 from paraspace.dexfile import DEXFile_linked
180 182
181 _install_dexfile_4_deptracker() 183 _install_dexfile_4_deptracker()
182 184
183 all_dep_decls = prepare_dep_decls() 185 all_dep_decls = prepare_dep_decls()
184 186
196 198
197 init_method = fakefile_linked.find_method_name('<init>', fakefile_def) 199 init_method = fakefile_linked.find_method_name('<init>', fakefile_def)
198 200
199 typeidxs = collect_typeidxs_in_method(fakefile_linked, init_method) 201 typeidxs = collect_typeidxs_in_method(fakefile_linked, init_method)
200 assert len(typeidxs) == 1 202 assert len(typeidxs) == 1
201 pass 203
204 typeid = fakefile_linked.find_typeid_idx(typeidxs[0])
205 typeid_name = DEXFile_linked.get_typeid_name(typeid)
206 assert typeid_name == 'Ljava/io/File;'
207
208 typeidxs = collect_typeidxs_mentioned_by_class(fakefile_linked,
209 fakefile_def)
210 assert len(typeidxs) == 1
211
212 typeid = fakefile_linked.find_typeid_idx(typeidxs[0])
213 typeid_name = DEXFile_linked.get_typeid_name(typeid)
214 assert typeid_name == 'Ljava/io/File;'
215 pass