mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-07-09 14:48:10 +00:00
Updated tests
This commit is contained in:
@@ -597,14 +597,13 @@ public class ActionScript3Test extends ActionScriptTestBase {
|
||||
|
||||
@Test
|
||||
public void testGotos() {
|
||||
decompileMethod("testGotos", "var _loc2_:Boolean = true;\r\n"
|
||||
+ "var _loc3_:Boolean = false;\r\n"
|
||||
+ "var _loc4_:Boolean = false;\r\n"
|
||||
+ "if(_loc2_)\r\n"
|
||||
decompileMethod("testGotos", "var a:Boolean = true;\r\n"
|
||||
+ "var b:Boolean = false;\r\n"
|
||||
+ "if(a)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"A\");\r\n"
|
||||
+ "}\r\n"
|
||||
+ "else if(_loc3_)\r\n"
|
||||
+ "else if(b)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "trace(\"B\");\r\n"
|
||||
+ "}\r\n"
|
||||
@@ -612,7 +611,7 @@ public class ActionScript3Test extends ActionScriptTestBase {
|
||||
+ "{\r\n"
|
||||
+ "try\r\n"
|
||||
+ "{\r\n"
|
||||
+ "if(_loc2_)\r\n"
|
||||
+ "if(a)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "return 7;\r\n"
|
||||
+ "}\r\n"
|
||||
@@ -1164,7 +1163,8 @@ public class ActionScript3Test extends ActionScriptTestBase {
|
||||
|
||||
@Test
|
||||
public void testSwitchComma() {
|
||||
decompileMethod("testSwitchComma", "var a:String = \"A\";\r\n"
|
||||
decompileMethod("testSwitchComma", "var b:int = 5;\r\n"
|
||||
+ "var a:String = \"A\";\r\n"
|
||||
+ "switch(a)\r\n"
|
||||
+ "{\r\n"
|
||||
+ "case \"A\":\r\n"
|
||||
@@ -1366,6 +1366,122 @@ public class ActionScript3Test extends ActionScriptTestBase {
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testXml() {
|
||||
decompileMethod("testXml", "var g:XML = null;\r\n"
|
||||
+ "var name:String = \"ahoj\";\r\n"
|
||||
+ "var myXML:XML = <order id=\"604\">\r\n"
|
||||
+ "<book isbn=\"12345\">\r\n"
|
||||
+ "<title>{name}</title>\r\n"
|
||||
+ "</book>\r\n"
|
||||
+ "</order>;\r\n"
|
||||
+ "var k:* = myXML.@id;\r\n"
|
||||
+ "var all:String = myXML.@*.toXMLString();\r\n"
|
||||
+ "k = myXML.book;\r\n"
|
||||
+ "k = myXML.book.(@isbn = \"12345\");\r\n"
|
||||
+ "g = <script>\r\n"
|
||||
+ "<![CDATA[\r\n"
|
||||
+ "function() {\r\n"
|
||||
+ "\r\n"
|
||||
+ "FBAS = {\r\n"
|
||||
+ "\r\n"
|
||||
+ "setSWFObjectID: function( swfObjectID ) {\r\n"
|
||||
+ "FBAS.swfObjectID = swfObjectID;\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "init: function( opts ) {\r\n"
|
||||
+ "FB.init( FB.JSON.parse( opts ) );\r\n"
|
||||
+ "\r\n"
|
||||
+ "FB.Event.subscribe( 'auth.sessionChange', function( response ) {\r\n"
|
||||
+ "FBAS.updateSwfSession( response.session );\r\n"
|
||||
+ "} );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "setCanvasAutoResize: function( autoSize, interval ) {\r\n"
|
||||
+ "FB.Canvas.setAutoResize( autoSize, interval );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "setCanvasSize: function( width, height ) {\r\n"
|
||||
+ "FB.Canvas.setSize( { width: width, height: height } );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "login: function( opts ) {\r\n"
|
||||
+ "FB.login( FBAS.handleUserLogin, FB.JSON.parse( opts ) );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "addEventListener: function( event ) {\r\n"
|
||||
+ "FB.Event.subscribe( event, function( response ) {\r\n"
|
||||
+ "FBAS.getSwf().handleJsEvent( event, FB.JSON.stringify( response ) );\r\n"
|
||||
+ "} );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "handleUserLogin: function( response ) {\r\n"
|
||||
+ "if( response.session == null ) {\r\n"
|
||||
+ "FBAS.updateSwfSession( null );\r\n"
|
||||
+ "return;\r\n"
|
||||
+ "}\r\n"
|
||||
+ "\r\n"
|
||||
+ "if( response.perms != null ) {\r\n"
|
||||
+ "// user is logged in and granted some permissions.\r\n"
|
||||
+ "// perms is a comma separated list of granted permissions\r\n"
|
||||
+ "FBAS.updateSwfSession( response.session, response.perms );\r\n"
|
||||
+ "} else {\r\n"
|
||||
+ "FBAS.updateSwfSession( response.session );\r\n"
|
||||
+ "}\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "logout: function() {\r\n"
|
||||
+ "FB.logout( FBAS.handleUserLogout );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "handleUserLogout: function( response ) {\r\n"
|
||||
+ "swf = FBAS.getSwf();\r\n"
|
||||
+ "swf.logout();\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "ui: function( params ) {\r\n"
|
||||
+ "obj = FB.JSON.parse( params );\r\n"
|
||||
+ "method = obj.method;\r\n"
|
||||
+ "cb = function( response ) { FBAS.getSwf().uiResponse( FB.JSON.stringify( response ), method ); }\r\n"
|
||||
+ "FB.ui( obj, cb );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "getSession: function() {\r\n"
|
||||
+ "session = FB.getSession();\r\n"
|
||||
+ "return FB.JSON.stringify( session );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "getLoginStatus: function() {\r\n"
|
||||
+ "FB.getLoginStatus( function( response ) {\r\n"
|
||||
+ "if( response.session ) {\r\n"
|
||||
+ "FBAS.updateSwfSession( response.session );\r\n"
|
||||
+ "} else {\r\n"
|
||||
+ "FBAS.updateSwfSession( null );\r\n"
|
||||
+ "}\r\n"
|
||||
+ "} );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "getSwf: function getSwf() {\r\n"
|
||||
+ "return document.getElementById( FBAS.swfObjectID );\r\n"
|
||||
+ "},\r\n"
|
||||
+ "\r\n"
|
||||
+ "updateSwfSession: function( session, extendedPermissions ) {\r\n"
|
||||
+ "swf = FBAS.getSwf();\r\n"
|
||||
+ "extendedPermissions = ( extendedPermissions == null ) ? '' : extendedPermissions;\r\n"
|
||||
+ "\r\n"
|
||||
+ "if( session == null ) {\r\n"
|
||||
+ "swf.sessionChange( null );\r\n"
|
||||
+ "} else {\r\n"
|
||||
+ "swf.sessionChange( FB.JSON.stringify( session ), FB.JSON.stringify( extendedPermissions.split( ',' ) ) );\r\n"
|
||||
+ "}\r\n"
|
||||
+ "}\r\n"
|
||||
+ "};\r\n"
|
||||
+ "}\r\n"
|
||||
+ "]]>\r\n"
|
||||
+ "</script>;\r\n",
|
||||
false);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOptionalParameters() {
|
||||
String methodName = "testOptionalParameters";
|
||||
|
||||
Binary file not shown.
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'23.01.2021'</value>
|
||||
<value>'24.01.2021'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::timeStamp</name>
|
||||
<value>'23.01.2021'</value>
|
||||
<value>'24.01.2021'</value>
|
||||
</define>
|
||||
<define append="true">
|
||||
<name>CONFIG::air</name>
|
||||
|
||||
@@ -77,11 +77,12 @@ package
|
||||
TestTry;
|
||||
TestTryReturn;
|
||||
TestVector;
|
||||
TestVector2;
|
||||
TestVector2;
|
||||
TestWhileAnd;
|
||||
TestWhileContinue;
|
||||
TestWhileTry;
|
||||
TestWhileTry2;
|
||||
TestXml;
|
||||
|
||||
SetupMyPackage1;
|
||||
SetupMyPackage2;
|
||||
|
||||
@@ -6,15 +6,14 @@ package tests
|
||||
|
||||
public final function run(param1:Object):int
|
||||
{
|
||||
var _loc2_:Boolean = true;
|
||||
var _loc3_:Boolean = false;
|
||||
var _loc4_:Boolean = false;
|
||||
var a:Boolean = true;
|
||||
var b:Boolean = false;
|
||||
|
||||
if (_loc2_)
|
||||
if (a)
|
||||
{
|
||||
trace("A");
|
||||
}
|
||||
else if (_loc3_)
|
||||
else if (b)
|
||||
{
|
||||
trace("B");
|
||||
|
||||
@@ -23,7 +22,7 @@ package tests
|
||||
{
|
||||
try
|
||||
{
|
||||
if (_loc2_)
|
||||
if (a)
|
||||
{
|
||||
return 7;
|
||||
}
|
||||
|
||||
25
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestXml.as
vendored
Normal file
25
libsrc/ffdec_lib/testdata/flashdevelop/src/tests/TestXml.as
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
package tests
|
||||
{
|
||||
public class TestXml
|
||||
{
|
||||
|
||||
public function run() : void
|
||||
{
|
||||
var name:String="ahoj";
|
||||
var myXML:XML=<order id="604">
|
||||
<book isbn="12345">
|
||||
<title>{name}</title>
|
||||
</book>
|
||||
</order>;
|
||||
|
||||
var k:*=myXML.@id;
|
||||
var all:String=myXML.@*.toXMLString();
|
||||
k=myXML.book;
|
||||
k=myXML.book.(@isbn="12345");
|
||||
|
||||
var g:XML=new XML("<script>\n\t\t\t\t<![CDATA[\n\t\t\t\t\tfunction() {\n\t\t\t\n\t\t\t\t\t\tFBAS = {\n\t\t\t\n\t\t\t\t\t\t\tsetSWFObjectID: function( swfObjectID ) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tFBAS.swfObjectID = swfObjectID;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tinit: function( opts ) {\n\t\t\t\t\t\t\t\tFB.init( FB.JSON.parse( opts ) );\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tFB.Event.subscribe( \'auth.sessionChange\', function( response ) {\n\t\t\t\t\t\t\t\t\tFBAS.updateSwfSession( response.session );\n\t\t\t\t\t\t\t\t} );\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetCanvasAutoResize: function( autoSize, interval ) {\n\t\t\t\t\t\t\t\tFB.Canvas.setAutoResize( autoSize, interval );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsetCanvasSize: function( width, height ) {\n\t\t\t\t\t\t\t\tFB.Canvas.setSize( { width: width, height: height } );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tlogin: function( opts ) {\n\t\t\t\t\t\t\t\tFB.login( FBAS.handleUserLogin, FB.JSON.parse( opts ) );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\taddEventListener: function( event ) {\n\t\t\t\t\t\t\t\tFB.Event.subscribe( event, function( response ) {\n\t\t\t\t\t\t\t\t\tFBAS.getSwf().handleJsEvent( event, FB.JSON.stringify( response ) );\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\thandleUserLogin: function( response ) {\n\t\t\t\t\t\t\t\tif( response.session == null ) {\n\t\t\t\t\t\t\t\t\tFBAS.updateSwfSession( null );\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif( response.perms != null ) {\n\t\t\t\t\t\t\t\t\t// user is logged in and granted some permissions.\n\t\t\t\t\t\t\t\t\t// perms is a comma separated list of granted permissions\n\t\t\t\t\t\t\t\t\tFBAS.updateSwfSession( response.session, response.perms );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tFBAS.updateSwfSession( response.session );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tlogout: function() {\n\t\t\t\t\t\t\t\tFB.logout( FBAS.handleUserLogout );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\thandleUserLogout: function( response ) {\n\t\t\t\t\t\t\t\tswf = FBAS.getSwf();\n\t\t\t\t\t\t\t\tswf.logout();\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tui: function( params ) {\n\t\t\t\t\t\t\t\tobj = FB.JSON.parse( params );\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tmethod = obj.method;\n\t\t\t\t\t\t\t\tcb = function( response ) { FBAS.getSwf().uiResponse( FB.JSON.stringify( response ), method ); }\n\t\t\t\t\t\t\t\tFB.ui( obj, cb );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tgetSession: function() {\n\t\t\t\t\t\t\t\tsession = FB.getSession();\n\t\t\t\t\t\t\t\treturn FB.JSON.stringify( session );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tgetLoginStatus: function() {\n\t\t\t\t\t\t\t\tFB.getLoginStatus( function( response ) {\n\t\t\t\t\t\t\t\t\tif( response.session ) {\n\t\t\t\t\t\t\t\t\t\tFBAS.updateSwfSession( response.session );\n\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\tFBAS.updateSwfSession( null );\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} );\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tgetSwf: function getSwf() {\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\treturn document.getElementById( FBAS.swfObjectID );\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tupdateSwfSession: function( session, extendedPermissions ) {\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tswf = FBAS.getSwf();\n\t\t\t\t\t\t\t\textendedPermissions = ( extendedPermissions == null ) ? \'\' : extendedPermissions;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif( session == null ) {\n\t\t\t\t\t\t\t\t\tswf.sessionChange( null );\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tswf.sessionChange( FB.JSON.stringify( session ), FB.JSON.stringify( extendedPermissions.split( \',\' ) ) );\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t]]>\n\t\t\t</script>");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user