changeset 62:8a1844afb76a

Testcase for _dex_type.to_str()
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 28 Jun 2011 12:54:22 +0800
parents 3e34c7d33182
children 21d9b6773242
files paraspace/tests/dexfile_test.py
diffstat 1 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/paraspace/tests/dexfile_test.py	Tue Jun 28 10:25:54 2011 +0800
+++ b/paraspace/tests/dexfile_test.py	Tue Jun 28 12:54:22 2011 +0800
@@ -333,3 +333,27 @@
     assert isinstance(codeitem.debugInfoOff, int)
     pass
 
+
+def dextype_to_str_test():
+    from paraspace.dex_deptracker import collect_all_dep_decls
+    from paraspace.dex_deptracker import build_dependencies
+    from paraspace.dex_deptracker import _install_markers
+    from paraspace.dex_deptracker import _patch_dex_type_markers
+    from paraspace.dex_deptracker import restore_dependencies
+
+    _install_dexfile_4_deptracker()
+
+    all_dep_decls = collect_all_dep_decls()
+    _install_markers(all_dep_decls)
+    _patch_dex_type_markers(all_dep_decls)
+
+    srcdir = os.path.dirname(__file__)
+    srcroot = os.path.join(srcdir, '..', '..')
+    testdatapath = os.path.join(srcroot, 'data', 'testdata1.dex')
+    dex = dexfile.DEXFile.open(testdatapath)
+
+    dex_raw = dex.to_str()
+    file_raw = file(testdatapath, 'r').read()
+    assert dex_raw == file_raw
+    pass
+