Mercurial > paraspace
comparison paraspace/tests/injection_test.py @ 109:835336632aba
Add collect_typeidxs_in_method()
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Mon, 01 Aug 2011 14:37:04 +0800 |
parents | 4b3573d039af |
children | 6380730a80b4 |
comparison
equal
deleted
inserted
replaced
108:18be67af7f1e | 109:835336632aba |
---|---|
170 code in fakefile_codes | 170 code in fakefile_codes |
171 pass | 171 pass |
172 pass | 172 pass |
173 pass | 173 pass |
174 pass | 174 pass |
175 | |
176 | |
177 def collect_types_in_method_test(): | |
178 from paraspace.dex_deptracker import prepare_dep_decls | |
179 from paraspace.injection import collect_typeidxs_in_method | |
180 | |
181 _install_dexfile_4_deptracker() | |
182 | |
183 all_dep_decls = prepare_dep_decls() | |
184 | |
185 srcdir = os.path.dirname(__file__) | |
186 srcroot = os.path.join(srcdir, '..', '..') | |
187 | |
188 fakefile_fn = os.path.join(srcroot, 'data', 'fakefile.dex') | |
189 fakefile_dex = dexfile.DEXFile.open(fakefile_fn) | |
190 fakefile_linked = \ | |
191 dexfile.DEXFile_linked. \ | |
192 build_dependencies(fakefile_dex, all_dep_decls) | |
193 | |
194 fakefile_def = \ | |
195 fakefile_linked.find_class_name('Lcom/codemud/fakefile/fakefile;') | |
196 | |
197 init_method = fakefile_linked.find_method_name('<init>', fakefile_def) | |
198 | |
199 typeidxs = collect_typeidxs_in_method(fakefile_linked, init_method) | |
200 assert len(typeidxs) == 1 | |
201 pass |