summaryrefslogtreecommitdiff
path: root/src/test/java/cuchaz/enigma/TestSourceIndex.java
diff options
context:
space:
mode:
authorGravatar Thog2017-03-08 08:17:04 +0100
committerGravatar Thog2017-03-08 08:17:04 +0100
commit6e464ea251cab63c776ece0b2a356f1498ffa294 (patch)
tree5ed30c03f5ac4cd2d6877874f5ede576049954f7 /src/test/java/cuchaz/enigma/TestSourceIndex.java
parentDrop unix case style and implement hashCode when equals is overrided (diff)
downloadenigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.gz
enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.tar.xz
enigma-fork-6e464ea251cab63c776ece0b2a356f1498ffa294.zip
Follow Fabric guidelines
Diffstat (limited to 'src/test/java/cuchaz/enigma/TestSourceIndex.java')
-rw-r--r--src/test/java/cuchaz/enigma/TestSourceIndex.java30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/test/java/cuchaz/enigma/TestSourceIndex.java b/src/test/java/cuchaz/enigma/TestSourceIndex.java
index 58d9ca9..6e9e5ae 100644
--- a/src/test/java/cuchaz/enigma/TestSourceIndex.java
+++ b/src/test/java/cuchaz/enigma/TestSourceIndex.java
@@ -4,27 +4,26 @@
4 * are made available under the terms of the GNU Lesser General Public 4 * are made available under the terms of the GNU Lesser General Public
5 * License v3.0 which accompanies this distribution, and is available at 5 * License v3.0 which accompanies this distribution, and is available at
6 * http://www.gnu.org/licenses/lgpl.html 6 * http://www.gnu.org/licenses/lgpl.html
7 * 7 *
8 * Contributors: 8 * Contributors:
9 * Jeff Martin - initial API and implementation 9 * Jeff Martin - initial API and implementation
10 ******************************************************************************/ 10 ******************************************************************************/
11package cuchaz.enigma;
12
13import java.io.File;
14import java.util.Set;
15import java.util.jar.JarFile;
16 11
17import org.junit.Test; 12package cuchaz.enigma;
18 13
19import com.google.common.collect.Sets; 14import com.google.common.collect.Sets;
20import com.strobel.decompiler.languages.java.ast.CompilationUnit; 15import com.strobel.decompiler.languages.java.ast.CompilationUnit;
21
22import cuchaz.enigma.mapping.ClassEntry; 16import cuchaz.enigma.mapping.ClassEntry;
17import org.junit.Test;
18
19import java.io.File;
20import java.util.Set;
21import java.util.jar.JarFile;
23 22
24public class TestSourceIndex { 23public class TestSourceIndex {
25 @Test 24 @Test
26 public void indexEverything() 25 public void indexEverything()
27 throws Exception { 26 throws Exception {
28 // Figure out where Minecraft is... 27 // Figure out where Minecraft is...
29 final String mcDir = System.getProperty("enigma.test.minecraftdir"); 28 final String mcDir = System.getProperty("enigma.test.minecraftdir");
30 File mcJar = null; 29 File mcJar = null;
@@ -32,20 +31,17 @@ public class TestSourceIndex {
32 String osname = System.getProperty("os.name").toLowerCase(); 31 String osname = System.getProperty("os.name").toLowerCase();
33 if (osname.contains("nix") || osname.contains("nux") || osname.contains("solaris")) { 32 if (osname.contains("nix") || osname.contains("nux") || osname.contains("solaris")) {
34 mcJar = new File(System.getProperty("user.home"), ".minecraft/versions/1.8.3/1.8.3.jar"); 33 mcJar = new File(System.getProperty("user.home"), ".minecraft/versions/1.8.3/1.8.3.jar");
35 } 34 } else if (osname.contains("mac") || osname.contains("darwin")) {
36 else if (osname.contains("mac") || osname.contains("darwin")) {
37 mcJar = new File(System.getProperty("user.home"), "Library/Application Support/minecraft/versions/1.8.3/1.8.3.jar"); 35 mcJar = new File(System.getProperty("user.home"), "Library/Application Support/minecraft/versions/1.8.3/1.8.3.jar");
38 } 36 } else if (osname.contains("win")) {
39 else if (osname.contains("win")) {
40 mcJar = new File(System.getenv("AppData"), ".minecraft/versions/1.8.3/1.8.3.jar"); 37 mcJar = new File(System.getenv("AppData"), ".minecraft/versions/1.8.3/1.8.3.jar");
41 } 38 }
42 } 39 } else {
43 else {
44 mcJar = new File(mcDir, "versions/1.8.3/1.8.3.jar"); 40 mcJar = new File(mcDir, "versions/1.8.3/1.8.3.jar");
45 } 41 }
46 42
47 Deobfuscator deobfuscator = new Deobfuscator(new JarFile(mcJar)); 43 Deobfuscator deobfuscator = new Deobfuscator(new JarFile(mcJar));
48 44
49 // get all classes that aren't inner classes 45 // get all classes that aren't inner classes
50 Set<ClassEntry> classEntries = Sets.newHashSet(); 46 Set<ClassEntry> classEntries = Sets.newHashSet();
51 for (ClassEntry obfClassEntry : deobfuscator.getJarIndex().getObfClassEntries()) { 47 for (ClassEntry obfClassEntry : deobfuscator.getJarIndex().getObfClassEntries()) {
@@ -53,7 +49,7 @@ public class TestSourceIndex {
53 classEntries.add(obfClassEntry); 49 classEntries.add(obfClassEntry);
54 } 50 }
55 } 51 }
56 52
57 for (ClassEntry obfClassEntry : classEntries) { 53 for (ClassEntry obfClassEntry : classEntries) {
58 try { 54 try {
59 CompilationUnit tree = deobfuscator.getSourceTree(obfClassEntry.getName()); 55 CompilationUnit tree = deobfuscator.getSourceTree(obfClassEntry.getName());