summaryrefslogtreecommitdiff
path: root/test/cuchaz/enigma/TestSourceIndex.java
diff options
context:
space:
mode:
authorGravatar jeff2015-02-03 22:00:53 -0500
committerGravatar jeff2015-02-03 22:00:53 -0500
commit52ab426d8fad3dbee7e728f523a35af94facebda (patch)
tree146fadfd8e639a909d6c1d6a193e7eddeab0be4a /test/cuchaz/enigma/TestSourceIndex.java
downloadenigma-fork-52ab426d8fad3dbee7e728f523a35af94facebda.tar.gz
enigma-fork-52ab426d8fad3dbee7e728f523a35af94facebda.tar.xz
enigma-fork-52ab426d8fad3dbee7e728f523a35af94facebda.zip
oops, don't depend on local procyon project
Diffstat (limited to 'test/cuchaz/enigma/TestSourceIndex.java')
-rw-r--r--test/cuchaz/enigma/TestSourceIndex.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/cuchaz/enigma/TestSourceIndex.java b/test/cuchaz/enigma/TestSourceIndex.java
new file mode 100644
index 0000000..70a5ee4
--- /dev/null
+++ b/test/cuchaz/enigma/TestSourceIndex.java
@@ -0,0 +1,49 @@
1/*******************************************************************************
2 * Copyright (c) 2014 Jeff Martin.
3 *
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the GNU Public License v3.0
6 * which accompanies this distribution, and is available at
7 * http://www.gnu.org/licenses/gpl.html
8 *
9 * Contributors:
10 * Jeff Martin - initial API and implementation
11 ******************************************************************************/
12package cuchaz.enigma;
13
14import java.util.Set;
15import java.util.jar.JarFile;
16
17import org.junit.Test;
18
19import com.google.common.collect.Sets;
20import com.strobel.decompiler.languages.java.ast.CompilationUnit;
21
22import cuchaz.enigma.mapping.ClassEntry;
23
24public class TestSourceIndex {
25
26 // TEMP
27 @Test
28 public void indexEverything() throws Exception {
29 Deobfuscator deobfuscator = new Deobfuscator(new JarFile("input/1.8.jar"));
30
31 // get all classes that aren't inner classes
32 Set<ClassEntry> classEntries = Sets.newHashSet();
33 for (ClassEntry obfClassEntry : deobfuscator.getJarIndex().getObfClassEntries()) {
34 if (!obfClassEntry.isInnerClass()) {
35 classEntries.add(obfClassEntry);
36 }
37 }
38
39 for (ClassEntry obfClassEntry : classEntries) {
40 try {
41 CompilationUnit tree = deobfuscator.getSourceTree(obfClassEntry.getName());
42 String source = deobfuscator.getSource(tree);
43 deobfuscator.getSourceIndex(tree, source);
44 } catch (Throwable t) {
45 throw new Error("Unable to index " + obfClassEntry, t);
46 }
47 }
48 }
49}