X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=lib%2Fas3%2Fok%2Freconcile.as;h=52049620bbc92fdb22b592fb0b99e370c2edb2a5;hb=98caa66dc7bb7a304b7b9d4d95d8d0849cefec01;hp=fd06ffc75f2dac638fb78a7e29577616902af638;hpb=a02b6b3166cc27457b99dee241fb3658e30d5ea1;p=swftools.git
diff --git a/lib/as3/ok/reconcile.as b/lib/as3/ok/reconcile.as
index fd06ffc..5204962 100644
--- a/lib/as3/ok/reconcile.as
+++ b/lib/as3/ok/reconcile.as
@@ -4,6 +4,14 @@
public class Main extends flash.display.MovieClip {
+ public function test0() {
+ // simple sanity test
+ while(false) {
+ var x1:String;
+ }
+ trace("ok 1/10");
+ }
+
// test whether local variables with default value "null"
// will be coerced to their object
public function test1() {
@@ -13,7 +21,7 @@
if(dataBuffer)
break;
}
- trace("ok 1/5");
+ trace("ok 2/10");
}
public function test2() {
@@ -21,7 +29,7 @@
while(output.length<1) {
output += "abc".charAt(0);
}
- trace("ok 2/5");
+ trace("ok 3/10");
}
public function test3() {
@@ -32,35 +40,179 @@
}
break;
}
- trace("ok 3/5");
+ trace("ok 4/10");
}
+ public var b:Boolean = false;
+
public function test4() {
var x:int;
var y:uint;
- if(escape("")) {
+ if(b) {
x = x+y;
y = y+x;
}
- trace("ok 4/5");
+ trace("ok 5/10");
}
public function test5() {
var x:int;
var y:uint;
var z:int;
- if(escape("")) {
+ if(b) {
x = x*y;
z = x*z;
}
- trace("ok 5/5");
+ trace("ok 6/10");
+ }
+ public function test6() {
+ var i:int = b?3.0:3;
+ var j:uint = b?3:"abc";
+ trace("ok 7/10");
+ }
+ public function test7() {
+ var j:Number = 0;
+ if(b) {
+ j += 8;
+ }
+ trace("ok 8/10");
+ }
+ public function s():String {
+ return "x";
+ }
+ public function test8() {
+ var x:String = "abcd";
+
+ var i:String = "test";
+ // test return types of system libraries
+ if(!b) {
+ i = x.charAt(0);
+ }
+ var a = "test";
+ // test return types of system libraries
+ if(!b) {
+ a = x.charAt(0);
+ }
+
+ // ...and local functions
+ if(!b) {
+ i = s();
+ }
+ trace("ok 9/10");
+ }
+
+ public function test_add() {
+ var i:int = 3;
+ var s:String = "4";
+ var any1 = "any1";
+ var any2 = "any2";
+ var xml:XML =
+ var xmllist:XMLList = XMLList()
+ var d1:Date = new Date();
+ var d2:Date = new Date();
+ var array1:Array = [1];
+ var array2:Array = [1,2];
+
+ /* int+String */
+ var z1a:Object;
+ var z1b:String;
+ if(b) {
+ z1a = i+s;
+ z1b = i+s;
+ }
+
+ /* String+int */
+ var z2a:Object;
+ var z2b:String;
+ if(b) {
+ z2a = s+i;
+ z2b = s+i;
+ }
+
+ /* any+any */
+ var z3a:*;
+ var z3b:Object;
+ if(b) {
+ z3a = any1+any2;
+ z3b = any1+any2;
+ }
+
+ /* any+String */
+ var z4a:Object;
+ var z4b:*;
+ if(b) {
+ z4a = any1+s;
+ z4b = any1+s;
+ }
+
+ /* xml+xmllist */
+ var z5a:Object;
+ var z5b:XMLList;
+ if(b) {
+ z5a = xml+xmllist;
+ z5b = xml+xmllist;
+ }
+
+ /* xmllist+xml */
+ var z6:Object;
+ if(b) {
+ z6 = xmllist+xml;
+ }
+
+ /* xml+any */
+ var z7a:*;
+ var z7b:XMLList;
+ if(b) {
+ z7a = xml+any1;
+ z7b = xml+any1;
+ }
+
+ /* date+date */
+ var z8a:Object;
+ var z8b:String;
+ if(b) {
+ z8a = d1+d2;
+ z8b = d1+d2;
+ }
+
+ /* date+any */
+ var z9a:Object;
+ var z9b:String;
+ if(b) {
+ z9a = d1+any1;
+ z9b = d1+any1;
+ }
+
+ /* any+date */
+ var z10a:Object;
+ var z10b:*;
+ if(b) {
+ z10a = any1+d1;
+ z10b = any1+d1;
+ }
+
+ /* array+array */
+ var z11a:Object;
+ var z11b:Array;
+ if(b) {
+ z11a = array1+array2;
+ z11b = array1+array2;
+ }
+ trace("ok 10/10");
}
public function Main() {
+ test0();
test1();
test2();
test3();
test4();
test5();
+ test6();
+ test7();
+ test8();
+ test_add();
+
+ trace("[exit]");
}
}
}