summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2018-12-04 22:49:03 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2018-12-04 22:49:03 (GMT)
commite146d7d8c7af50d2592379570c66acaf1dfa73c9 (patch)
tree31f20677a1a46427383080cba0c8f61652c8f51c /tests
parent9e58f9ae7208eeaf09a4b0af2f60996341d6af50 (diff)
Updated the Java descriptor demangling process.
Diffstat (limited to 'tests')
-rw-r--r--tests/mangling/java.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/mangling/java.py b/tests/mangling/java.py
new file mode 100644
index 0000000..072852f
--- /dev/null
+++ b/tests/mangling/java.py
@@ -0,0 +1,30 @@
+#!/usr/bin/python3-dbg
+# -*- coding: utf-8 -*-
+
+
+# Tests validant le décodage des types et des routines pour le format Java
+
+
+from chrysacase import ChrysalideTestCase
+from pychrysalide.mangling import JavaDemangler
+
+
+class TestJavaMangling(ChrysalideTestCase):
+ """TestCase for pychrysalide.mangling.JavaDemangler."""
+
+ def testJavaSpecMangling(self):
+ """Check Java demangling samples from specifications."""
+
+ demangler = JavaDemangler()
+
+ demangled = demangler.decode_type('I')
+ self.assertEqual(str(demangled), 'int')
+
+ demangled = demangler.decode_type('Ljava/lang/Object;')
+ self.assertEqual(str(demangled), 'java.lang.Object')
+
+ demangled = demangler.decode_type('[[[D')
+ self.assertEqual(str(demangled), 'double [][][]')
+
+ demangled = demangler.decode_routine('(IDLjava/lang/Thread;)Ljava/lang/Object;')
+ self.assertEqual(str(demangled), 'java.lang.Object (int, double, java.lang.Thread)')