This commit is contained in:
Jindra Petřík
2021-02-20 20:58:54 +01:00
parent a36ca2df20
commit b9749678f9
7 changed files with 122 additions and 1 deletions

View File

@@ -430,6 +430,66 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
false);
}
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchLoopBreak6(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchLoopBreak6", "var a:int = 0;\r\n"
+ "a = 0;\r\n"
+ "trace(\"before loop\");\r\n"
+ "while(a < 10)\r\n"
+ "{\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch1\");\r\n"
+ "if(a > 3)\r\n"
+ "{\r\n"
+ "break;\r\n"
+ "}\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try2\");\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch2\");\r\n"
+ "if(a > 4)\r\n"
+ "{\r\n"
+ "break;\r\n"
+ "}\r\n"
+ "}\r\n"
+ "}\r\n"
+ "a++;\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n",
false);
}
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchReturn(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchReturn", "var a:int = 0;\r\n"
+ "a = 5;\r\n"
+ "trace(\"before try\");\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch\");\r\n"
+ "if(a == 5)\r\n"
+ "{\r\n"
+ "return a;\r\n"
+ "}\r\n"
+ "trace(\"in catch2\");\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n"
+ "return -1;\r\n",
false);
}
@Test(dataProvider = "swfNamesProvider")
public void testTryCatchTry(String swfUsed) {
decompileMethod(swfUsed, "testTryCatchTry", "trace(\"before try\");\r\n"

View File

@@ -421,6 +421,66 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
false);
}
@Test
public void testTryCatchLoopBreak6() {
decompileMethod("swftools", "testTryCatchLoopBreak6", "var _loc1_:int = 0;\r\n"
+ "_loc1_ = 0;\r\n"
+ "trace(\"before loop\");\r\n"
+ "while(_loc1_ < 10)\r\n"
+ "{\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch1\");\r\n"
+ "if(_loc1_ > 3)\r\n"
+ "{\r\n"
+ "break;\r\n"
+ "}\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try2\");\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch2\");\r\n"
+ "if(_loc1_ > 4)\r\n"
+ "{\r\n"
+ "break;\r\n"
+ "}\r\n"
+ "}\r\n"
+ "}\r\n"
+ "_loc1_++;\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n",
false);
}
@Test
public void testTryCatchReturn() {
decompileMethod("swftools", "testTryCatchReturn", "var _loc1_:int = 0;\r\n"
+ "_loc1_ = 5;\r\n"
+ "trace(\"before try\");\r\n"
+ "try\r\n"
+ "{\r\n"
+ "trace(\"in try\");\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch\");\r\n"
+ "if(_loc1_ == 5)\r\n"
+ "{\r\n"
+ "return _loc1_;\r\n"
+ "}\r\n"
+ "trace(\"in catch2\");\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n"
+ "return -1;\r\n",
false);
}
@Test
public void testTryCatchTry() {
decompileMethod("swftools", "testTryCatchTry", "trace(\"before try\");\r\n"

View File

@@ -9,7 +9,8 @@ package tests
public function run() : int
{
var a:int = 5;
var a:int;
a = 5;
trace("before try");
try
{