Fixed: Try..catch.finally vs loops

This commit is contained in:
Jindra Petřík
2021-02-02 09:42:38 +01:00
parent 8878940754
commit f6744eafb9
20 changed files with 866 additions and 171 deletions

View File

@@ -76,6 +76,68 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
false);
}
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchInWhile(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchInWhile", "trace(\"before loop\");\r\n"
+ "while(true)\r\n"
+ "{\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"
+ "while(true)\r\n"
+ "{\r\n"
+ "trace(\"a\");\r\n"
+ "}\r\n"
+ "}\r\n"
+ "catch(e:EOFError)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "}\r\n",
false);
}
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchInWhile2(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchInWhile2", "var a:int = 0;\r\n"
+ "a = 0;\r\n"
+ "trace(\"before loop\");\r\n"
+ "while(a > 5)\r\n"
+ "{\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"
+ "if(a == 6)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "if(a == 7)\r\n"
+ "{\r\n"
+ "break;\r\n"
+ "}\r\n"
+ "trace(\"after inner while\");\r\n"
+ "}\r\n"
+ "catch(e:EOFError)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "if(a == 8)\r\n"
+ "{\r\n"
+ "break;\r\n"
+ "}\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "a++;\r\n"
+ "}\r\n",
false);
}
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchLoop(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchLoop", "var j:int = 0;\r\n"