From 97a49a511ccafbbff3b49ec90af761244d3a9227 Mon Sep 17 00:00:00 2001 From: Matthias Kramm Date: Sat, 14 Mar 2009 00:24:46 +0100 Subject: [PATCH] added more test cases --- lib/as3/ok/class1.as | 9 ++++++++- lib/as3/ok/getset2.as | 17 +++++++++++++++++ lib/as3/ok/namespaces1.as | 4 ++++ lib/as3/ok/trycatch.as | 43 +++++++++++++++++++++++++++++++++++++------ 4 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 lib/as3/ok/getset2.as diff --git a/lib/as3/ok/class1.as b/lib/as3/ok/class1.as index 15307d4..0ab0cdb 100644 --- a/lib/as3/ok/class1.as +++ b/lib/as3/ok/class1.as @@ -1,9 +1,16 @@ package test1 { public class Main extends flash.display.MovieClip { + + const ok1:String = "ok 1/4", ok2:String = "ok 2/4"; + var ok3:String = "ok 3/4", ok4:String = "ok 4/4"; + var xx:Main=null; function Main() { - trace("ok"); + trace(ok1); + trace(this.ok2); + trace(this.ok3); + trace(ok4); trace("[exit]"); } } diff --git a/lib/as3/ok/getset2.as b/lib/as3/ok/getset2.as new file mode 100644 index 0000000..9d50eb8 --- /dev/null +++ b/lib/as3/ok/getset2.as @@ -0,0 +1,17 @@ + +package { + import flash.display.MovieClip; + + public class Main extends flash.display.MovieClip { + public static function set foobar(val:String ):void { + } + public static function get foobar():String + { + return "ok"; + } + function Main() { + trace(Main.foobar); + trace("[exit]"); + } + } +} diff --git a/lib/as3/ok/namespaces1.as b/lib/as3/ok/namespaces1.as index aabad2d..e289ac3 100644 --- a/lib/as3/ok/namespaces1.as +++ b/lib/as3/ok/namespaces1.as @@ -3,6 +3,8 @@ package my.namespaces { public namespace ns2 = "http://www.swftools.org/"; public namespace ns3 = "http://yet.some.other/namespace"; public namespace ns4 = "bla bla"; + + public namespace ns5 = "bla bla 2"; public class Test { @@ -42,6 +44,8 @@ package { public class Main extends flash.display.MovieClip { use namespace my.namespaces.ns2; + import my.namespaces.*; + use namespace ns5; private function test1() { my.namespaces.Test.test() diff --git a/lib/as3/ok/trycatch.as b/lib/as3/ok/trycatch.as index c47cb6d..9f8dbc0 100644 --- a/lib/as3/ok/trycatch.as +++ b/lib/as3/ok/trycatch.as @@ -1,12 +1,41 @@ package { import flash.display.MovieClip; + import flash.net.navigateToURL; public class MyError { } public class MyOtherError { - var ok5="ok 5/5"; + var ok5="ok 5/7"; + } + public class ClassWithStaticFunctions { + static function ok7() { + trace("ok 7/7"); + } } public class Main extends flash.display.MovieClip { + + public function getClass():Class { + return ClassWithStaticFunctions; + } + + public function checkScope():void + { + try { + flash.net.navigateToURL; + } catch (e:Error) { + } + trace("ok 6/7"); + + with(getClass()) { + try { + throw new Error; + } catch(e:Error) { + ok7(); + } + } + } + + function Main() { try { throw new MyError @@ -15,7 +44,7 @@ package { // MyError is not of the Error class trace("error"); } catch(error:MyError) { - trace("ok 1/5"); + trace("ok 1/7"); } catch(x) { trace("error"); } @@ -26,11 +55,11 @@ package { } catch(error:MyError) { trace("error"); } catch(x:*) { // ":*" is the same as "" - trace("ok 2/5"); + trace("ok 2/7"); } try { - trace("ok 3/5"); + trace("ok 3/7"); // don't throw any error } catch(error:MyError) { trace("error"); @@ -40,14 +69,16 @@ package { trace("error"); } - trace("ok 4/5"); + trace("ok 4/7"); try {throw new MyOtherError} catch(x:*) { trace((x as MyOtherError).ok5); } - trace("[exit]"); + checkScope(); + + trace("[exit]"); } } } -- 1.7.10.4