Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ix0rai committed Oct 3, 2023
1 parent 3213246 commit 25021e3
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.nio.file.Path;

public class CheckMappingsCommandTest extends CommandTest {
private static final Path JAR = TestUtil.obfJar("packageAccess");
private static final Path JAR = TestUtil.obfJar("package_access");
private static final Path WRONG_MAPPINGS = getResource("/packageAccess/wrongMappings");
private static final Path CORRECT_MAPPINGS = getResource("/packageAccess/correctMappings");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static org.junit.jupiter.api.Assertions.assertNull;

public class FillClassMappingsCommandTest extends CommandTest {
private static final Path JAR = TestUtil.obfJar("innerClasses");
private static final Path JAR = TestUtil.obfJar("inner_classes");
private static final Path MAPPINGS = getResource("/fillClassMappings/");

private static final ClassEntry A = new ClassEntry("a");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void testVarargsDecompile(DecompilerService decompiler) {
TokenChecker checker = this.getTokenChecker(decompiler);
MethodEntry method = TestEntryFactory.newMethod("a", "a", "()V");
assertThat(checker.getReferenceTokens(
new EntryReference<>(TestEntryFactory.newMethod("org/enigma/inputs/Keep", "a", "([Ljava/lang/String;)V"), "", method)
new EntryReference<>(TestEntryFactory.newMethod("org/quiltmc/enigma/inputs/Keep", "a", "([Ljava/lang/String;)V"), "", method)
), contains("a"));
assertThat(checker.getReferenceTokens(
new EntryReference<>(TestEntryFactory.newClass("java/lang/String"), "", method)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import static org.hamcrest.Matchers.containsInAnyOrder;

public class PackageVisibilityIndexTest {
public static final Path JAR = TestUtil.obfJar("packageAccess");
private static final ClassEntry KEEP = TestEntryFactory.newClass("org/enigma/inputs/Keep");
public static final Path JAR = TestUtil.obfJar("package_access");
private static final ClassEntry KEEP = TestEntryFactory.newClass("org/quiltmc/enigma/inputs/Keep");
private static final ClassEntry BASE = TestEntryFactory.newClass("a");
private static final ClassEntry SAME_PACKAGE_CHILD = TestEntryFactory.newClass("b");
private static final ClassEntry SAME_PACKAGE_CHILD_INNER = TestEntryFactory.newClass("b$a");
Expand Down
2 changes: 1 addition & 1 deletion enigma/src/test/java/org/quiltmc/enigma/TestDeobfed.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static void beforeClass() throws Exception {
@Test
public void obfEntries() {
assertThat(deobfProject.getJarIndex().getEntryIndex().getClasses(), Matchers.containsInAnyOrder(
TestEntryFactory.newClass("org/enigma/inputs/Keep"),
TestEntryFactory.newClass("org/quiltmc/enigma/inputs/Keep"),
TestEntryFactory.newClass("a"),
TestEntryFactory.newClass("b"),
TestEntryFactory.newClass("c"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import java.nio.file.Path;

public class TestDeobfuscator {
private static final Path JAR = TestUtil.obfJar("loneClass");
private static final Path JAR = TestUtil.obfJar("lone_class");

private EnigmaProject openProject() throws IOException {
Enigma enigma = Enigma.create();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import static org.hamcrest.Matchers.equalTo;

public class TestInnerClassParameterStats {
private static final Path JAR = TestUtil.obfJar("innerClasses");
private static final Path JAR = TestUtil.obfJar("inner_classes");

@Test
public void testInnerClassParameterStats() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class TestInnerClasses {
private static final ClassEntry CLASS_TREE_LEVEL_2 = TestEntryFactory.newClass("f$a$a");
private static final ClassEntry CLASS_TREE_LEVEL_3 = TestEntryFactory.newClass("f$a$a$a");

public static final Path JAR = TestUtil.obfJar("innerClasses");
public static final Path JAR = TestUtil.obfJar("inner_classes");
private final JarIndex index;
private final Decompiler decompiler;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public TestJarIndexBridgeMethods() throws Exception {

@Test
public void obfEntries() {
assertThat(this.index.getEntryIndex().getClasses(), Matchers.containsInAnyOrder(TestEntryFactory.newClass("org/enigma/inputs/Keep"), this.baseClass,
assertThat(this.index.getEntryIndex().getClasses(), Matchers.containsInAnyOrder(TestEntryFactory.newClass("org/quiltmc/enigma/inputs/Keep"), this.baseClass,
this.otherClass, this.subClass, this.innerSubClass));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public TestJarIndexConstructorReferences() throws Exception {

@Test
public void obfEntries() {
assertThat(this.index.getEntryIndex().getClasses(), Matchers.containsInAnyOrder(TestEntryFactory.newClass("org/enigma/inputs/Keep"), BASE_CLASS,
assertThat(this.index.getEntryIndex().getClasses(), Matchers.containsInAnyOrder(TestEntryFactory.newClass("org/quiltmc/enigma/inputs/Keep"), BASE_CLASS,
SUB_CLASS, SUBSUB_CLASS, DEFAULT_CLASS, CALLER_CLASS));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import static org.hamcrest.Matchers.*;

public class TestJarIndexInheritanceTree {
public static final Path JAR = TestUtil.obfJar("inheritanceTree");
public static final Path JAR = TestUtil.obfJar("inheritance_tree");

private static final ClassEntry BASE_CLASS = TestEntryFactory.newClass("a");
private static final ClassEntry SUB_CLASS_A = TestEntryFactory.newClass("b");
Expand All @@ -44,7 +44,7 @@ public TestJarIndexInheritanceTree() throws Exception {
@Test
public void obfEntries() {
assertThat(this.index.getEntryIndex().getClasses(), Matchers.containsInAnyOrder(
TestEntryFactory.newClass("org/enigma/inputs/Keep"), BASE_CLASS, SUB_CLASS_A, SUB_CLASS_AA, SUB_CLASS_B
TestEntryFactory.newClass("org/quiltmc/enigma/inputs/Keep"), BASE_CLASS, SUB_CLASS_A, SUB_CLASS_AA, SUB_CLASS_B
));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static org.hamcrest.Matchers.*;

public class TestJarIndexLoneClass {
public static final Path JAR = TestUtil.obfJar("loneClass");
public static final Path JAR = TestUtil.obfJar("lone_class");
private final JarIndex index;

public TestJarIndexLoneClass() throws Exception {
Expand All @@ -40,7 +40,7 @@ public TestJarIndexLoneClass() throws Exception {
@Test
public void obfEntries() {
assertThat(this.index.getEntryIndex().getClasses(), Matchers.containsInAnyOrder(
TestEntryFactory.newClass("org/enigma/inputs/Keep"),
TestEntryFactory.newClass("org/quiltmc/enigma/inputs/Keep"),
TestEntryFactory.newClass("a")
));
}
Expand All @@ -49,11 +49,11 @@ public void obfEntries() {
public void translationIndex() {
InheritanceIndex inheritanceIndex = this.index.getInheritanceIndex();
assertThat(inheritanceIndex.getParents(new ClassEntry("a")), is(empty()));
assertThat(inheritanceIndex.getParents(new ClassEntry("org/enigma/inputs/Keep")), is(empty()));
assertThat(inheritanceIndex.getParents(new ClassEntry("org/quiltmc/enigma/inputs/Keep")), is(empty()));
assertThat(inheritanceIndex.getAncestors(new ClassEntry("a")), is(empty()));
assertThat(inheritanceIndex.getAncestors(new ClassEntry("org/enigma/inputs/Keep")), is(empty()));
assertThat(inheritanceIndex.getAncestors(new ClassEntry("org/quiltmc/enigma/inputs/Keep")), is(empty()));
assertThat(inheritanceIndex.getChildren(new ClassEntry("a")), is(empty()));
assertThat(inheritanceIndex.getChildren(new ClassEntry("org/enigma/inputs/Keep")), is(empty()));
assertThat(inheritanceIndex.getChildren(new ClassEntry("org/quiltmc/enigma/inputs/Keep")), is(empty()));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import java.nio.file.Path;

public final class TestTinyV2InnerClasses {
public static final Path JAR = TestUtil.obfJar("innerClasses");
public static final Path JAR = TestUtil.obfJar("inner_classes");
public static final Path MAPPINGS = TestUtil.getResource("/tinyV2InnerClasses/");

@Test
Expand Down
2 changes: 1 addition & 1 deletion enigma/src/test/resources/proguard-bridge-test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
-dontshrink
-keepparameternames
-keepattributes
-keep class inputs.org.quiltmc.enigma.Keep
-keep class org.quiltmc.enigma.inputs.Keep
5 changes: 2 additions & 3 deletions enigma/src/test/resources/proguard-build.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
-dontoptimize
-dontobfuscate
-dontwarn
-keep class org.enigma.Main { static void main(java.lang.String[]); }
-keep class command.org.quiltmc.enigma.Main { static void main(java.lang.String[]); }
-keep class de.sciss.syntaxpane.** { *; }
-keep class org.quiltmc.enigma.Main { static void main(java.lang.String[]); }
-keep class org.quiltmc.enigma.command.Main { static void main(java.lang.String[]); }
4 changes: 2 additions & 2 deletions enigma/src/test/resources/proguard-enums-test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
-dontshrink
-keepparameternames
-keepattributes
-keep class inputs.org.quiltmc.enigma.Keep
-keepclassmembers enum enums.inputs.org.quiltmc.enigma.Color {
-keep class org.quiltmc.enigma.inputs.Keep
-keepclassmembers enum org.quiltmc.enigma.inputs.enums.Color {
public static **[] values();
public static ** valueOf(java.lang.String);
}
2 changes: 1 addition & 1 deletion enigma/src/test/resources/proguard-test.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
-dontshrink
-keepparameternames
-keepattributes
-keep class inputs.org.quiltmc.enigma.Keep
-keep class org.quiltmc.enigma.inputs.Keep
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CLASS f org/enigma/Dad
CLASS f org/quiltmc/enigma/Dad
CLASS a One
CLASS a Two
CLASS a
Expand Down
4 changes: 2 additions & 2 deletions enigma/src/testFixtures/java/org/quiltmc/enigma/TestUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ private TestUtil() {
}

public static Path obfJar(String name) {
return Path.of("../enigma/build/test-obf/%s.jar".formatted(name)).toAbsolutePath();
return Path.of("").toAbsolutePath().getParent().resolve("enigma/build/test-obf/%s.jar".formatted(name));
}

public static Path deobfJar(String name) {
return Path.of("../enigma/build/test-deobf/%s.jar".formatted(name)).toAbsolutePath();
return Path.of("").toAbsolutePath().getParent().resolve("enigma/build/test-deobf/%s.jar".formatted(name));
}

public static Path getResource(String name) {
Expand Down

0 comments on commit 25021e3

Please sign in to comment.