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

test: add test case for #43 (PR #576)

上级 10fb57f6
package jadx.tests.integration.loops;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.io.File;
import java.io.FileOutputStream;
import org.junit.jupiter.api.Test;
import jadx.NotYetImplemented;
import jadx.tests.api.IntegrationTest;
public class TestBreakInLoop3 extends IntegrationTest {
public static class TestCls {
private StringBuilder builder = new StringBuilder();
public void writeMore(String fid) {
boolean tryMkdir = true;
File ff = new File(fid);
while (true) {
prt("1");
try {
new FileOutputStream(fid).close();
} catch (Exception ex) {
if (tryMkdir) { // On first error, try creating the base dirs.
tryMkdir = false;
prt("2");
continue;
}
prt("3");
if (ff.exists()) {
prt("4");
} else {
prt("5");
}
prt("6");
}
prt("7");
break;
} // end of while true, loop to allow retry of fos.write after mkdir
prt("8");
} // end of writeMore
private void prt(String s) {
builder.append(s);
}
public void check() {
writeMore("");
assertEquals("12135678", builder.toString());
}
}
@Test
@NotYetImplemented
public void test43() throws Exception {
getClassNode(TestCls.class);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册