test: NYI tests for #836 and #837

This commit is contained in:
Skylot
2020-01-27 19:23:35 +00:00
parent 49ce92f540
commit 1bb90233b9
2 changed files with 81 additions and 0 deletions
@@ -0,0 +1,38 @@
package jadx.tests.integration.types;
import org.junit.jupiter.api.Test;
import jadx.NotYetImplemented;
import jadx.tests.api.IntegrationTest;
public class TestTypeResolver11 extends IntegrationTest {
public static class TestCls {
public Void test(Object... objArr) {
int val = (Integer) objArr[0];
String str = (String) objArr[1];
call(str, str, val, val);
return null;
}
private void call(String a, String b, int... val) {
}
public void check() {
test(1, "str");
}
}
@NotYetImplemented("Missing cast")
@Test
public void test() {
getClassNode(TestCls.class);
}
@NotYetImplemented("Missing cast")
@Test
public void testNoDebug() {
noDebugInfo();
getClassNode(TestCls.class);
}
}
@@ -0,0 +1,43 @@
package jadx.tests.integration.types;
import java.lang.ref.WeakReference;
import org.junit.jupiter.api.Test;
import jadx.NotYetImplemented;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
public class TestTypeResolver12 extends IntegrationTest {
public abstract static class TestCls<T> {
private WeakReference<T> ref;
public void test(String str) {
T obj = this.ref.get();
if (obj != null) {
call(obj, str);
}
}
public abstract void call(T t, String str);
}
@Test
public void test() {
assertThat(getClassNode(TestCls.class))
.code()
.containsOne("T obj = this.ref.get();");
}
@NotYetImplemented("Generic type inference")
@Test
public void testNoDebug() {
noDebugInfo();
assertThat(getClassNode(TestCls.class))
.code()
.doesNotContain("Object obj")
.containsOne("T obj = this.ref.get();");
}
}