fix: resolve some cases of switch in loop (#876)

This commit is contained in:
Skylot
2020-03-21 18:41:54 +00:00
parent 4cdad0e83e
commit 2da772df8e
4 changed files with 78 additions and 14 deletions
@@ -0,0 +1,34 @@
package jadx.tests.integration.switches;
import org.junit.jupiter.api.Test;
import jadx.tests.api.IntegrationTest;
import static jadx.tests.api.utils.assertj.JadxAssertions.assertThat;
public class TestSwitchInLoop2 extends IntegrationTest {
public static class TestCls {
public boolean test() {
while (true) {
switch (call()) {
case 0:
return false;
case 1:
return true;
}
}
}
private int call() {
return 0;
}
}
@Test
public void test() {
assertThat(getClassNode(TestCls.class))
.code()
.containsOne("while (true) {")
.containsOne("switch (call()) {");
}
}