Commit 01dfae4a authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

test: add test case for anonymous type, and move assertions to NYI (PR #589)

parent 395cae43
package jadx.tests.integration.inner;
import org.junit.jupiter.api.Test;
import jadx.NotYetImplemented;
import jadx.tests.api.IntegrationTest;
public class TestAnonymousClass13 extends IntegrationTest {
public static class TestCls {
public void test() {
new TestCls() {
};
}
}
@Test
@NotYetImplemented
public void test() {
getClassNode(TestCls.class);
}
}
......@@ -33,7 +33,7 @@ public class TestAnonymousClass2 extends IntegrationTest {
}
};
}
/*
public Runnable test3() {
final int i = f + 2;
return new Runnable() {
......@@ -43,7 +43,6 @@ public class TestAnonymousClass2 extends IntegrationTest {
}
};
}
*/
}
}
......@@ -55,7 +54,7 @@ public class TestAnonymousClass2 extends IntegrationTest {
assertThat(code, not(containsString("synthetic")));
assertThat(code, not(containsString("AnonymousClass_")));
assertThat(code, containsString("f = 1;"));
// assertThat(code, containsString("f = i;"));
assertThat(code, containsString("f = i;"));
assertThat(code, not(containsString("Inner obj = ;")));
assertThat(code, containsString("Inner.this;"));
}
......
......@@ -2,11 +2,13 @@ package jadx.tests.integration.inner;
import org.junit.jupiter.api.Test;
import jadx.NotYetImplemented;
import jadx.core.dex.nodes.ClassNode;
import jadx.tests.api.IntegrationTest;
import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.not;
public class TestAnonymousClass3 extends IntegrationTest {
......@@ -47,9 +49,17 @@ public class TestAnonymousClass3 extends IntegrationTest {
assertThat(code, containsString(indent(4) + "public void run() {"));
assertThat(code, containsString(indent(3) + "}.start();"));
// assertThat(code, not(containsString("synthetic")));
// assertThat(code, not(containsString("AnonymousClass_")));
assertThat(code, not(containsString("AnonymousClass_")));
}
@Test
@NotYetImplemented
public void test2() {
disableCompilation();
ClassNode cls = getClassNode(TestCls.class);
String code = cls.getCode().toString();
// assertThat(code, containsString("a = f--;"));
assertThat(code, not(containsString("synthetic")));
assertThat(code, containsString("a = f--;"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment