renamed new as3 test swfs to have as3 prefix and unique SWF name

This commit is contained in:
Jindra Petřík
2021-02-03 07:07:22 +01:00
parent 347648c77e
commit 26b51d2e95
191 changed files with 69 additions and 68 deletions

View File

@@ -0,0 +1,37 @@
package
{
import flash.display.MovieClip;
import flash.events.Event;
import tests.*;
/**
* ...
* @author JPEXS
*/
public class Main extends MovieClip
{
TestTryCatch;
TestTryCatchIfInTry;
TestTryCatchInWhile;
TestTryCatchInWhile2;
TestTryCatchLoop;
TestTryCatchExceptionUsage
TestTryFinally;
TestTryFinallyDirectReturnInFinally;
TestTryFinallyLoop;
TestTryFinallyLoopInFinally;
TestTryFinallyMultipleCatch;
TestTryFinallyNoCatch;
TestTryFinallyReturn;
TestTryFinallyReturnInFinally;
TestTryFinallyReturnNested;
TestTryFinallyReturnVoid;
public function Main()
{
}
}
}

View File

@@ -0,0 +1,26 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryCatch
{
public function run() : void
{
trace("before try");
try
{
trace("in try");
}
catch (e:Error)
{
trace("in catch");
}
trace("after");
}
}
}

View File

@@ -0,0 +1,26 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryCatchExceptionUsage
{
public function run() : void
{
trace("before try");
try
{
trace("in try");
}
catch (e:Error)
{
trace("catched exception: "+e.message);
}
trace("after");
}
}
}

View File

@@ -0,0 +1,32 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryCatchIfInTry
{
public function run() : void
{
var a:Boolean = true;
trace("before");
try
{
if (a)
{
trace("ret");
return;
}
trace("in try");
}
catch (e:Error)
{
trace("in catch");
}
trace("after");
}
}
}

View File

@@ -0,0 +1,41 @@
package tests
{
import flash.errors.EOFError;
/**
* ...
* @author JPEXS
*/
public class TestTryCatchInWhile
{
public function run() : void
{
trace("before loop");
while (true)
{
try
{
trace("in try");
while (true)
{
trace("a");
}
//not reachable in ASC2
//trace("after inner while");
}
catch (e:EOFError)
{
continue;
}
catch (e:Error)
{
continue;
}
}
//not reachable in ASC2:
//trace("after loop");
}
}
}

View File

@@ -0,0 +1,48 @@
package tests
{
import flash.errors.EOFError;
/**
* ...
* @author JPEXS
*/
public class TestTryCatchInWhile2
{
public function run() : void
{
var a:int;
a = 0;
trace("before loop");
while (a > 5)
{
try
{
trace("in try");
if (a == 6){
continue;
}
if (a == 7){
break;
}
trace("after inner while");
}
catch (e:EOFError)
{
continue;
}
catch (e:Error)
{
if (a == 8){
break;
}
continue;
}
a++;
}
//not reachable in ASC2:
//trace("after loop");
}
}
}

View File

@@ -0,0 +1,42 @@
package tests
{
import flash.errors.EOFError;
/**
* ...
* @author JPEXS
*/
public class TestTryCatchLoop
{
public function run() : void
{
var i:int = 0;
while (i < 100)
{
try
{
var j:int = 0;
while (j < 20)
{
trace("a");
j++;
}
}
catch (e:EOFError)
{
continue;
}
catch (e:Error)
{
continue;
}
trace("after_try");
i++;
}
trace("end");
}
}
}

View File

@@ -0,0 +1,30 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinally
{
public function run() : void
{
trace("before try");
try
{
trace("in try");
}
catch (e:Error)
{
trace("in catch");
}
finally
{
trace("in finally");
}
trace("after");
}
}
}

View File

@@ -0,0 +1,34 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyDirectReturnInFinally
{
public function run() : String
{
var str:String = "xxx";
try
{
}
catch (e:Error)
{
trace("error");
}
finally
{
trace("hi ");
if (str == "check")
{
return str;
}
return "hu" + str;
}
}
}
}

View File

@@ -0,0 +1,41 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyLoop
{
public function run() : void
{
var i:int = 0;
while (i < 10)
{
trace("before try");
try
{
trace("in try");
if (i == 5)
{
i += 5;
trace("continue while");
continue;
}
}
catch (e:Error)
{
trace("in catch");
}
finally
{
trace("in finally");
}
trace("after");
i++;
}
}
}
}

View File

@@ -0,0 +1,41 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyLoopInFinally
{
public function run() : void
{
var i:int = 0;
while (i < 10)
{
trace("before try");
try
{
trace("in try");
}
catch (e:Error)
{
trace("in catch");
}
finally
{
if (i == 5)
{
i += 7;
trace("continue while");
continue;
}
trace("in finally");
}
trace("after");
i++
}
}
}
}

View File

@@ -0,0 +1,35 @@
package tests
{
import flash.errors.EOFError;
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyMultipleCatch
{
public function run() : void
{
trace("before try");
try
{
trace("in try");
}
catch (e:Error)
{
trace("in catch Error");
}
catch (e:EOFError)
{
trace("in catch EOFError");
}
finally
{
trace("in finally");
}
trace("after");
}
}
}

View File

@@ -0,0 +1,26 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyNoCatch
{
public function run() : void
{
trace("before try");
try
{
trace("in try");
}
finally
{
trace("in finally");
}
trace("after");
}
}
}

View File

@@ -0,0 +1,42 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyReturn
{
public function run() : String
{
trace("before try");
try
{
trace("in try");
var a:int = 5;
if (a > 4)
{
return "RET";
}
trace("between");
if (a < 3)
{
return "RE2";
}
trace("in try2");
}
catch (e:Error)
{
trace("in catch");
}
finally
{
trace("in finally");
}
trace("after");
return "RETFINAL";
}
}
}

View File

@@ -0,0 +1,44 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyReturnInFinally
{
public function run() : String
{
trace("before try");
try
{
trace("in try");
var a:int = 5;
if (a > 4)
{
return "RET";
}
}
catch (e:Error)
{
trace("in catch");
}
finally
{
trace("in finally");
if (a > 6){
return "FINRET1";
}
trace("xx");
if (a > 5){
return "FINRET2";
}
trace("nofinret");
}
trace("after");
return "RETEXIT";
}
}
}

View File

@@ -0,0 +1,43 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyReturnNested
{
public function run() : String
{
var a:int = Math.random() * 5;
try
{
trace("before try2");
try
{
trace("in try2");
if (a > 4)
{
return "RET";
}
}
catch (e:Error)
{
trace("in catch");
}
finally
{
trace("in finally2");
}
trace("after");
}
finally
{
trace("in finally1");
}
return "RETFINAL";
}
}
}

View File

@@ -0,0 +1,36 @@
package tests
{
/**
* ...
* @author JPEXS
*/
public class TestTryFinallyReturnVoid
{
public function run() : void
{
var a:int = Math.random() * 5;
trace("before try");
try
{
trace("in try");
if (a > 4)
{
return;
}
trace("in try2");
}
catch (e:Error)
{
trace("in catch");
}
finally
{
trace("in finally");
}
trace("after");
}
}
}