summaryrefslogtreecommitdiff
path: root/tests/mangling
diff options
context:
space:
mode:
Diffstat (limited to 'tests/mangling')
-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)')