提交 01dfae4a 编写于 作者: A Ahmed Ashour 提交者: skylot

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

上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册