diff options
| author | 2015-02-08 23:10:26 -0500 | |
|---|---|---|
| committer | 2015-02-08 23:10:26 -0500 | |
| commit | 31a1a418b04cd3e7b06cb50cb8674a2c25079f6c (patch) | |
| tree | 5914fd0c3557250dc61382a571ea3a3cdb9d941d /test | |
| parent | Merge with 09538fb039f2e4e5e240cfb331be512ae8740fda (diff) | |
| download | enigma-31a1a418b04cd3e7b06cb50cb8674a2c25079f6c.tar.gz enigma-31a1a418b04cd3e7b06cb50cb8674a2c25079f6c.tar.xz enigma-31a1a418b04cd3e7b06cb50cb8674a2c25079f6c.zip | |
added types to fields
Diffstat (limited to 'test')
| -rw-r--r-- | test/cuchaz/enigma/EntryFactory.java | 9 | ||||
| -rw-r--r-- | test/cuchaz/enigma/TestJarIndexInheritanceTree.java | 4 | ||||
| -rw-r--r-- | test/cuchaz/enigma/TestJarIndexLoneClass.java | 12 | ||||
| -rw-r--r-- | test/cuchaz/enigma/TestTranslator.java | 3 | ||||
| -rw-r--r-- | test/cuchaz/enigma/resources/translation.mappings | 6 |
5 files changed, 20 insertions, 14 deletions
diff --git a/test/cuchaz/enigma/EntryFactory.java b/test/cuchaz/enigma/EntryFactory.java index fa90779d..8c94bdf3 100644 --- a/test/cuchaz/enigma/EntryFactory.java +++ b/test/cuchaz/enigma/EntryFactory.java | |||
| @@ -18,6 +18,7 @@ import cuchaz.enigma.mapping.ConstructorEntry; | |||
| 18 | import cuchaz.enigma.mapping.FieldEntry; | 18 | import cuchaz.enigma.mapping.FieldEntry; |
| 19 | import cuchaz.enigma.mapping.MethodEntry; | 19 | import cuchaz.enigma.mapping.MethodEntry; |
| 20 | import cuchaz.enigma.mapping.Signature; | 20 | import cuchaz.enigma.mapping.Signature; |
| 21 | import cuchaz.enigma.mapping.Type; | ||
| 21 | 22 | ||
| 22 | public class EntryFactory { | 23 | public class EntryFactory { |
| 23 | 24 | ||
| @@ -25,12 +26,12 @@ public class EntryFactory { | |||
| 25 | return new ClassEntry(name); | 26 | return new ClassEntry(name); |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | public static FieldEntry newField(String className, String fieldName) { | 29 | public static FieldEntry newField(String className, String fieldName, String fieldType) { |
| 29 | return newField(newClass(className), fieldName); | 30 | return newField(newClass(className), fieldName, fieldType); |
| 30 | } | 31 | } |
| 31 | 32 | ||
| 32 | public static FieldEntry newField(ClassEntry classEntry, String fieldName) { | 33 | public static FieldEntry newField(ClassEntry classEntry, String fieldName, String fieldType) { |
| 33 | return new FieldEntry(classEntry, fieldName); | 34 | return new FieldEntry(classEntry, fieldName, new Type(fieldType)); |
| 34 | } | 35 | } |
| 35 | 36 | ||
| 36 | public static MethodEntry newMethod(String className, String methodName, String methodSignature) { | 37 | public static MethodEntry newMethod(String className, String methodName, String methodSignature) { |
diff --git a/test/cuchaz/enigma/TestJarIndexInheritanceTree.java b/test/cuchaz/enigma/TestJarIndexInheritanceTree.java index 1d6e5a55..349d33b1 100644 --- a/test/cuchaz/enigma/TestJarIndexInheritanceTree.java +++ b/test/cuchaz/enigma/TestJarIndexInheritanceTree.java | |||
| @@ -37,8 +37,8 @@ public class TestJarIndexInheritanceTree { | |||
| 37 | private ClassEntry m_subClassA = newClass("none/b"); | 37 | private ClassEntry m_subClassA = newClass("none/b"); |
| 38 | private ClassEntry m_subClassAA = newClass("none/d"); | 38 | private ClassEntry m_subClassAA = newClass("none/d"); |
| 39 | private ClassEntry m_subClassB = newClass("none/c"); | 39 | private ClassEntry m_subClassB = newClass("none/c"); |
| 40 | private FieldEntry m_nameField = new FieldEntry(m_baseClass, "a"); | 40 | private FieldEntry m_nameField = newField(m_baseClass, "a", "Ljava/lang/String;"); |
| 41 | private FieldEntry m_numThingsField = new FieldEntry(m_subClassB, "a"); | 41 | private FieldEntry m_numThingsField = newField(m_subClassB, "a", "I"); |
| 42 | 42 | ||
| 43 | public TestJarIndexInheritanceTree() | 43 | public TestJarIndexInheritanceTree() |
| 44 | throws Exception { | 44 | throws Exception { |
diff --git a/test/cuchaz/enigma/TestJarIndexLoneClass.java b/test/cuchaz/enigma/TestJarIndexLoneClass.java index c6a9e550..c0ac8d7d 100644 --- a/test/cuchaz/enigma/TestJarIndexLoneClass.java +++ b/test/cuchaz/enigma/TestJarIndexLoneClass.java | |||
| @@ -64,9 +64,10 @@ public class TestJarIndexLoneClass { | |||
| 64 | 64 | ||
| 65 | @Test | 65 | @Test |
| 66 | public void access() { | 66 | public void access() { |
| 67 | assertThat(m_index.getAccess(newField("none/a", "a")), is(Access.Private)); | 67 | assertThat(m_index.getAccess(newField("none/a", "a", "Ljava/lang/String;")), is(Access.Private)); |
| 68 | assertThat(m_index.getAccess(newMethod("none/a", "a", "()Ljava/lang/String;")), is(Access.Public)); | 68 | assertThat(m_index.getAccess(newMethod("none/a", "a", "()Ljava/lang/String;")), is(Access.Public)); |
| 69 | assertThat(m_index.getAccess(newField("none/a", "b")), is(nullValue())); | 69 | assertThat(m_index.getAccess(newField("none/a", "b", "Ljava/lang/String;")), is(nullValue())); |
| 70 | assertThat(m_index.getAccess(newField("none/a", "a", "LFoo;")), is(nullValue())); | ||
| 70 | } | 71 | } |
| 71 | 72 | ||
| 72 | @Test | 73 | @Test |
| @@ -110,7 +111,7 @@ public class TestJarIndexLoneClass { | |||
| 110 | @Test | 111 | @Test |
| 111 | @SuppressWarnings("unchecked") | 112 | @SuppressWarnings("unchecked") |
| 112 | public void fieldReferences() { | 113 | public void fieldReferences() { |
| 113 | FieldEntry source = newField("none/a", "a"); | 114 | FieldEntry source = newField("none/a", "a", "Ljava/lang/String;"); |
| 114 | Collection<EntryReference<FieldEntry,BehaviorEntry>> references = m_index.getFieldReferences(source); | 115 | Collection<EntryReference<FieldEntry,BehaviorEntry>> references = m_index.getFieldReferences(source); |
| 115 | assertThat(references, containsInAnyOrder( | 116 | assertThat(references, containsInAnyOrder( |
| 116 | newFieldReferenceByConstructor(source, "none/a", "(Ljava/lang/String;)V"), | 117 | newFieldReferenceByConstructor(source, "none/a", "(Ljava/lang/String;)V"), |
| @@ -157,8 +158,9 @@ public class TestJarIndexLoneClass { | |||
| 157 | public void contains() { | 158 | public void contains() { |
| 158 | assertThat(m_index.containsObfClass(newClass("none/a")), is(true)); | 159 | assertThat(m_index.containsObfClass(newClass("none/a")), is(true)); |
| 159 | assertThat(m_index.containsObfClass(newClass("none/b")), is(false)); | 160 | assertThat(m_index.containsObfClass(newClass("none/b")), is(false)); |
| 160 | assertThat(m_index.containsObfField(newField("none/a", "a")), is(true)); | 161 | assertThat(m_index.containsObfField(newField("none/a", "a", "Ljava/lang/String;")), is(true)); |
| 161 | assertThat(m_index.containsObfField(newField("none/a", "b")), is(false)); | 162 | assertThat(m_index.containsObfField(newField("none/a", "b", "Ljava/lang/String;")), is(false)); |
| 163 | assertThat(m_index.containsObfField(newField("none/a", "a", "LFoo;")), is(false)); | ||
| 162 | assertThat(m_index.containsObfBehavior(newMethod("none/a", "a", "()Ljava/lang/String;")), is(true)); | 164 | assertThat(m_index.containsObfBehavior(newMethod("none/a", "a", "()Ljava/lang/String;")), is(true)); |
| 163 | assertThat(m_index.containsObfBehavior(newMethod("none/a", "b", "()Ljava/lang/String;")), is(false)); | 165 | assertThat(m_index.containsObfBehavior(newMethod("none/a", "b", "()Ljava/lang/String;")), is(false)); |
| 164 | } | 166 | } |
diff --git a/test/cuchaz/enigma/TestTranslator.java b/test/cuchaz/enigma/TestTranslator.java index 290f6f04..f91c5852 100644 --- a/test/cuchaz/enigma/TestTranslator.java +++ b/test/cuchaz/enigma/TestTranslator.java | |||
| @@ -35,5 +35,8 @@ public class TestTranslator { | |||
| 35 | throws Exception { | 35 | throws Exception { |
| 36 | Translator translator = m_deobfuscator.getTranslator(TranslationDirection.Deobfuscating); | 36 | Translator translator = m_deobfuscator.getTranslator(TranslationDirection.Deobfuscating); |
| 37 | assertThat(translator.translateEntry(newClass("none/a")), is(newClass("deobf/A"))); | 37 | assertThat(translator.translateEntry(newClass("none/a")), is(newClass("deobf/A"))); |
| 38 | assertThat(translator.translateEntry(newField("none/a", "a", "I")), is(newField("deobf/A", "one", "I"))); | ||
| 39 | assertThat(translator.translateEntry(newField("none/a", "a", "F")), is(newField("deobf/A", "two", "F"))); | ||
| 40 | assertThat(translator.translateEntry(newField("none/a", "a", "Ljava/lang/String;")), is(newField("deobf/A", "three", "Ljava/lang/String;"))); | ||
| 38 | } | 41 | } |
| 39 | } | 42 | } |
diff --git a/test/cuchaz/enigma/resources/translation.mappings b/test/cuchaz/enigma/resources/translation.mappings index 70755bf6..c71493e9 100644 --- a/test/cuchaz/enigma/resources/translation.mappings +++ b/test/cuchaz/enigma/resources/translation.mappings | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | CLASS none/a deobf/A | 1 | CLASS none/a deobf/A |
| 2 | FIELD a one | 2 | FIELD a one I |
| 3 | FIELD b two | 3 | FIELD a two F |
| 4 | FIELD c three \ No newline at end of file | 4 | FIELD a three Ljava/lang/String; \ No newline at end of file |