mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-08-02 15:32:15 +00:00
tests
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -9,7 +9,8 @@ package tests
|
||||
|
||||
public function run() : int
|
||||
{
|
||||
var a:int = 5;
|
||||
var a:int;
|
||||
a = 5;
|
||||
trace("before try");
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user