new tests, fix for non-breakable space bug
authorMatthias Kramm <kramm@quiss.org>
Tue, 21 Jul 2009 11:56:00 +0000 (13:56 +0200)
committerMatthias Kramm <kramm@quiss.org>
Tue, 21 Jul 2009 11:56:00 +0000 (13:56 +0200)
lib/as3/ok/arrays.as
lib/as3/ok/ops.as
lib/as3/ok/this.as
lib/as3/test
lib/as3/tokenizer.lex

index c56c34d..51aad81 100644 (file)
@@ -5,20 +5,25 @@ package {
     public class Main extends flash.display.MovieClip {
         function Main() {
             var a:Array = new Array(1,2,3);
     public class Main extends flash.display.MovieClip {
         function Main() {
             var a:Array = new Array(1,2,3);
-            if(a[0]==1) trace("ok 1/8");
-            if(a[1]==2) trace("ok 2/8");
-            if(a[2]==3) trace("ok 3/8");
-            if(a.length==3) trace("ok 4/8");
+            if(a[0]==1) trace("ok 1/10");
+            if(a[1]==2) trace("ok 2/10");
+            if(a[2]==3) trace("ok 3/10");
+            if(a.length==3) trace("ok 4/10");
 
             var b:Array = [1,2,3];
 
             var b:Array = [1,2,3];
-            if(b[0]==1) trace("ok 5/8");
-            if(b[1]==2) trace("ok 6/8");
-            if(b[2]==3) trace("ok 7/8");
-            if(b.length==3) trace("ok 8/8");
+            if(b[0]==1) trace("ok 5/10");
+            if(b[1]==2) trace("ok 6/10");
+            if(b[2]==3) trace("ok 7/10");
+            if(b.length==3) trace("ok 8/10");
           
             // test for ]+<int> parser bug:
             var check = (3 == a[0]+1);
           
             // test for ]+<int> parser bug:
             var check = (3 == a[0]+1);
-            
+
+           var list:Array = ["ok 9/10", "ok 10/10"];
+           for each(var s:String in list) {
+               trace(s);
+           }                    
+
             trace("[exit]");
         }
     }
             trace("[exit]");
         }
     }
index 87de785..9f14136 100644 (file)
@@ -3,7 +3,7 @@ package {
     import flash.display.MovieClip
     public class Main extends flash.display.MovieClip {
         var count:int = 1;
     import flash.display.MovieClip
     public class Main extends flash.display.MovieClip {
         var count:int = 1;
-        var num:int = 28;
+        var num:int = 30;
         function assert(b:Boolean) {
             if(b) {
                 trace("ok "+count+"/"+num);
         function assert(b:Boolean) {
             if(b) {
                 trace("ok "+count+"/"+num);
@@ -39,6 +39,13 @@ package {
             assert(2+3==5);
             assert(2-3==-1);
 
             assert(2+3==5);
             assert(2-3==-1);
 
+           /* test or */
+           var y = 0;
+           var x = y || 1;
+           assert(x);
+           var z = x && 1;
+           assert(z);
+
             /* test not */
             trace("[not]");
             assert(!false);
             /* test not */
             trace("[not]");
             assert(!false);
index 1668ee9..61c70a5 100644 (file)
@@ -2,10 +2,10 @@ package {
     import flash.display.MovieClip
     public class Main extends flash.display.MovieClip {
         internal var s0;
     import flash.display.MovieClip
     public class Main extends flash.display.MovieClip {
         internal var s0;
-        internal var s1:String="ok 3/4";
+        internal var s1:String="ok 3/5";
         internal var s2;
         public function printok1() {
         internal var s2;
         public function printok1() {
-            trace("ok 1/4");
+            trace("ok 1/5");
         }
         public function printok2(x:uint) {
             trace(this.s0);
         }
         public function printok2(x:uint) {
             trace(this.s0);
@@ -13,18 +13,28 @@ package {
         public function printok3() {
             trace(this.s2);
         }
         public function printok3() {
             trace(this.s2);
         }
+
+        public function f() {
+           trace("ok 5/5");
+       }
+        public function get_f() {
+           return this["f"];
+       }                                                                                                         
+
         function Main() {
 
             this.printok1();
         function Main() {
 
             this.printok1();
-            this.s0 = "ok 2/4";
+            this.s0 = "ok 2/5";
             this.printok2(0);
 
             // member w/ default value:
             trace(this.s1);
 
             //omit "this":
             this.printok2(0);
 
             // member w/ default value:
             trace(this.s1);
 
             //omit "this":
-            s2 = "ok 4/4";
+            s2 = "ok 4/5";
             printok3();
             printok3();
+
+           get_f()();
             
             trace("[exit]");
         }
             
             trace("[exit]");
         }
index a458c3e..1100996 100755 (executable)
@@ -213,7 +213,7 @@ class TestBase:
         return 1
 
     def run(self):
         return 1
 
     def run(self):
-        ret,output = runcmd("flashplayer",["abc.swf"],wait=cache.runtime)
+        ret,output = runcmd("flashplayer",[os.path.join(os.getcwd(),"abc.swf")],wait=cache.runtime)
         os.system("killall flashplayer")
         self.flash_output = output
         
         os.system("killall flashplayer")
         self.flash_output = output
         
index 7b57674..3da6c22 100644 (file)
@@ -110,10 +110,10 @@ void handleInclude(char*text, int len, char quotes)
     } else {
         int i1=0,i2=len;
         // find start
     } else {
         int i1=0,i2=len;
         // find start
-        while(!strchr(" \n\r\t", text[i1])) i1++;
+        while(!strchr(" \n\r\t\xa0", text[i1])) i1++;
         // strip
         // strip
-        while(strchr(" \n\r\t", text[i1])) i1++;
-        while(strchr(" \n\r\t", text[i2-1])) i2--;
+        while(strchr(" \n\r\t\xa0", text[i1])) i1++;
+        while(strchr(" \n\r\t\xa0", text[i2-1])) i2--;
         if(i2!=len) text[i2]=0;
         filename = strdup(&text[i1]);
     }
         if(i2!=len) text[i2]=0;
         filename = strdup(&text[i1]);
     }
@@ -533,7 +533,7 @@ XMLID       [A-Za-z0-9_\x80-\xff]+([:][A-Za-z0-9_\x80-\xff]+)?
 XMLSTRING   ["][^"]*["]
 
 STRING   ["](\\[\x00-\xff]|[^\\"\n])*["]|['](\\[\x00-\xff]|[^\\'\n])*[']
 XMLSTRING   ["][^"]*["]
 
 STRING   ["](\\[\x00-\xff]|[^\\"\n])*["]|['](\\[\x00-\xff]|[^\\'\n])*[']
-S       [ \n\r\t]
+S       [ \n\r\t\xa0]
 MULTILINE_COMMENT [/][*]+([*][^/]|[^/*]|[^*][/]|[\x00-\x1f])*[*]+[/]
 SINGLELINE_COMMENT \/\/[^\n\r]*[\n\r]
 REGEXP   [/]([^/\n]|\\[/])*[/][a-zA-Z]*
 MULTILINE_COMMENT [/][*]+([*][^/]|[^/*]|[^*][/]|[\x00-\x1f])*[*]+[/]
 SINGLELINE_COMMENT \/\/[^\n\r]*[\n\r]
 REGEXP   [/]([^/\n]|\\[/])*[/][a-zA-Z]*
@@ -545,7 +545,7 @@ REGEXP   [/]([^/\n]|\\[/])*[/][a-zA-Z]*
 [/][*]                       {syntaxerror("syntax error: unterminated comment", yytext);}
 
 ^include{S}+{STRING}{S}*/\n    {l();handleInclude(yytext, yyleng, 1);}
 [/][*]                       {syntaxerror("syntax error: unterminated comment", yytext);}
 
 ^include{S}+{STRING}{S}*/\n    {l();handleInclude(yytext, yyleng, 1);}
-^include{S}+[^" \t\r\n][\x20-\xff]*{S}*/\n    {l();handleInclude(yytext, yyleng, 0);}
+^include{S}+[^" \t\xa0\r\n][\x20-\xff]*{S}*/\n    {l();handleInclude(yytext, yyleng, 0);}
 {STRING}                     {l(); BEGIN(DEFAULT);handleString(yytext, yyleng);return T_STRING;}
 {CDATA}                      {l(); BEGIN(DEFAULT);handleCData(yytext, yyleng);return T_STRING;}
 
 {STRING}                     {l(); BEGIN(DEFAULT);handleString(yytext, yyleng);return T_STRING;}
 {CDATA}                      {l(); BEGIN(DEFAULT);handleCData(yytext, yyleng);return T_STRING;}