Skip to content

Commit

Permalink
test: NYI tests for #836 and #837
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Jan 27, 2020
1 parent 49ce92f commit 1bb9023
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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();");
}
}

0 comments on commit 1bb9023

Please sign in to comment.