diff 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
line wrap: on
line diff
--- a/paraspace/tests/injection_test.py	Mon Aug 01 14:37:04 2011 +0800
+++ b/paraspace/tests/injection_test.py	Mon Aug 01 15:00:29 2011 +0800
@@ -177,6 +177,8 @@
 def collect_types_in_method_test():
     from paraspace.dex_deptracker import prepare_dep_decls
     from paraspace.injection import collect_typeidxs_in_method
+    from paraspace.injection import collect_typeidxs_mentioned_by_class
+    from paraspace.dexfile import DEXFile_linked
     
     _install_dexfile_4_deptracker()
     
@@ -198,4 +200,16 @@
 
     typeidxs = collect_typeidxs_in_method(fakefile_linked, init_method)
     assert len(typeidxs) == 1
+
+    typeid = fakefile_linked.find_typeid_idx(typeidxs[0])
+    typeid_name = DEXFile_linked.get_typeid_name(typeid)
+    assert typeid_name == 'Ljava/io/File;'
+    
+    typeidxs = collect_typeidxs_mentioned_by_class(fakefile_linked,
+                                                   fakefile_def)
+    assert len(typeidxs) == 1
+
+    typeid = fakefile_linked.find_typeid_idx(typeidxs[0])
+    typeid_name = DEXFile_linked.get_typeid_name(typeid)
+    assert typeid_name == 'Ljava/io/File;'
     pass