gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] /srv/bzr/gnash/trunk r11146: Make the testsuite slightly


From: Benjamin Wolsey
Subject: [Gnash-commit] /srv/bzr/gnash/trunk r11146: Make the testsuite slightly less irrational and easier to run as3compile
Date: Thu, 18 Jun 2009 11:35:03 +0200
User-agent: Bazaar (1.13.1)

------------------------------------------------------------
revno: 11146
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Thu 2009-06-18 11:35:03 +0200
message:
  Make the testsuite slightly less irrational and easier to run as3compile
  testcases without all the haxe tests first.
  
  Add more useful AS3 tests.
  
  Fix some low-level bugs with function calling in AVM2.
added:
  testsuite/as3compile.all/function.as
  testsuite/as3compile.all/lookup.as
renamed:
  testsuite/as3/ => testsuite/as3compile.all/
  testsuite/as3/classes.all/ => testsuite/misc-haxe.all/classes.all/
  testsuite/as3/internal.all/ => testsuite/misc-haxe.all/internal.all/
modified:
  configure.ac
  libcore/vm/Machine.cpp
  testsuite/Makefile.am
  testsuite/as3compile.all/Makefile.am
  testsuite/misc-haxe.all/Makefile.am
    ------------------------------------------------------------
    revno: 11144.1.1
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 09:39:10 +0200
    message:
      Test for classes with the same name (and for function calls).
    added:
      testsuite/as3/lookup.as
    ------------------------------------------------------------
    revno: 11144.1.2
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 09:39:34 +0200
    message:
      Run test.
    modified:
      testsuite/as3/Makefile.am
    ------------------------------------------------------------
    revno: 11144.1.3
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:03:35 +0200
    message:
      Log more information about properties called / constructed.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11144.1.4
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:04:14 +0200
    message:
      Don't push return of constructor onto stack.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11144.1.5
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:23:21 +0200
    message:
      Test function calls and returns (static and non-static).
    added:
      testsuite/as3/function.as
    ------------------------------------------------------------
    revno: 11144.1.6
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:23:39 +0200
    message:
      Run test.
    modified:
      testsuite/as3/Makefile.am
    ------------------------------------------------------------
    revno: 11144.1.7
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:34:55 +0200
    message:
      Return undefined on RETURNVOID. Fixes more function calls.
    modified:
      libcore/vm/Machine.cpp
    ------------------------------------------------------------
    revno: 11144.1.8
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:38:16 +0200
    message:
      check->xcheck for tests that don't pass yet.
    modified:
      testsuite/as3/function.as
      testsuite/as3/lookup.as
    ------------------------------------------------------------
    revno: 11144.1.9
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 10:46:14 +0200
    message:
      Move classes.all and internal.all to misc-haxe.all, where it is then 
      automatically dependant on haxe being installed, and not first on 
as3compile.
      
      Rename testsuite/as3 to testsuite/as3compile.all.
    renamed:
      testsuite/as3/ => testsuite/as3compile.all/
      testsuite/as3/classes.all/ => testsuite/misc-haxe.all/classes.all/
      testsuite/as3/internal.all/ => testsuite/misc-haxe.all/internal.all/
    modified:
      configure.ac
      testsuite/Makefile.am
      testsuite/as3compile.all/Makefile.am
      testsuite/misc-haxe.all/Makefile.am
    ------------------------------------------------------------
    revno: 11144.1.10
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 11:05:55 +0200
    message:
      More function tests.
    modified:
      testsuite/as3compile.all/function.as
    ------------------------------------------------------------
    revno: 11144.1.11
    committer: Benjamin Wolsey <address@hidden>
    branch nick: work
    timestamp: Thu 2009-06-18 11:08:21 +0200
    message:
      One more test, totals.
    modified:
      testsuite/as3compile.all/function.as
=== modified file 'configure.ac'
--- a/configure.ac      2009-06-12 10:07:13 +0000
+++ b/configure.ac      2009-06-18 08:46:14 +0000
@@ -2306,14 +2306,14 @@
 testsuite/Makefile
 testsuite/media/Makefile
 testsuite/libbase.all/Makefile
-testsuite/as3/Makefile
-testsuite/as3/classes.all/Makefile
+testsuite/as3compile.all/Makefile
 testsuite/actionscript.all/Makefile
 testsuite/samples/Makefile
 testsuite/swfdec/Makefile
 testsuite/misc-ming.all/Makefile
 testsuite/misc-mtasc.all/Makefile
 testsuite/misc-haxe.all/Makefile
+testsuite/misc-haxe.all/classes.all/Makefile
 testsuite/misc-swfmill.all/Makefile
 testsuite/misc-swfc.all/Makefile
 testsuite/network.all/Makefile

=== modified file 'libcore/vm/Machine.cpp'
--- a/libcore/vm/Machine.cpp    2009-06-17 09:36:39 +0000
+++ b/libcore/vm/Machine.cpp    2009-06-18 09:35:03 +0000
@@ -1373,6 +1373,9 @@
                     if (a.isRuntime()) {
                         mStack.drop(completeName(a));
                     }
+                    
+                    log_abc("CALL_PROP*: calling property %s of object %s",
+                            mST.value(a.getGlobalName()), mStack.top(0));
 
                     as_value object_val = pop_stack();
 
@@ -1453,12 +1456,10 @@
                     mStream->seekTo(0);
                     if (!mStateStack.size()) return;
                     
+                    mGlobalReturn = as_value();
                     restoreState();
+                    
                     if (mExitWithReturn) return;
-                    // Slot the return.
-                    //*mGlobalReturn = as_value();
-                    // And restore the previous state.
-                    //restoreState();
                     break;
                 
                 /// 0x48 ABC_ACTION_RETURNVALUE
@@ -1528,9 +1529,16 @@
                 {
                     as_environment env = as_environment(_vm);
                     asName a = pool_name(mStream->read_V32(), mPoolObject);
+                    
                     boost::uint32_t argc = mStream->read_V32();
-                    std::auto_ptr< std::vector<as_value> > args = 
get_args(argc);
+                    std::auto_ptr<std::vector<as_value> > args = 
get_args(argc);
+                    
+                    log_abc("CONSTRUCT_PROP: will try to construct property "
+                            "%s on object %s", mST.value(a.getGlobalName()),
+                            mStack.top(0));
+
                     as_object* object = pop_stack().to_object().get();
+
                     if (!object) {
                         //TODO: Should this result in an exeception or an 
                         // actionscript error?
@@ -1539,9 +1547,10 @@
                         push_stack(as_value());
                         break;
                     }
-                    //std::string& classname = 
mPoolObject->mStringPool[a.getABCName()];
                     
-                    as_value constructor_val = 
object->getMember(a.getGlobalName());
+                    as_value constructor_val =
+                        object->getMember(a.getGlobalName());
+
                     boost::intrusive_ptr<as_function> constructor =
                         constructor_val.to_as_function();
                     
@@ -1550,24 +1559,28 @@
                             constructor->constructInstance(env, args);
                         push_stack(as_value(newobj));
                     }
-                    // TODO: This else clause is needed to construct classes 
that
-                    // aren't builtin into gnash. I don't think this is 
correct,
-                    // and I think the problem might be how AVM2 adds
+                    // TODO: This else clause is needed to construct classes
+                    // that aren't builtin into gnash. I don't think this is
+                    // correct, and I think the problem might be how AVM2 adds
                     // new objects to the Global object.
                     else {
-                        log_abc("Object %s is not a constructor", 
-                                constructor_val.toDebugString());
-                        if (constructor_val.is_null() || 
constructor_val.is_undefined()) {
-                            log_abc("Constructor is undefined, will not 
construct "
-                                    "property.");
+                        log_abc("The property we found (%s) is not a "
+                                "constructor", constructor_val);
+
+                        if (constructor_val.is_null() ||
+                                constructor_val.is_undefined()) {
+
+                            log_abc("Constructor is undefined, will not "
+                                    "construct property.");
                             push_stack(as_value());
                         }
                         else {
-                            as_value val = 
constructor_val.to_object().get()->getMember(
+                            as_value val =
+                                constructor_val.to_object().get()->getMember(
                                     NSV::PROP_CONSTRUCTOR, 0);
-                            as_value result = call_method(val, env,
-                                    constructor_val.to_object().get(),args);
-                            push_stack(result);
+
+                            call_method(val, env,
+                                    constructor_val.to_object().get(), args);
                         }
                     }
                     
@@ -2223,7 +2236,6 @@
                     asName a = pool_name(mStream->read_V32(), mPoolObject);
 
                     as_value value = mStack.top(0);
-                    LOG_ONCE(log_unimpl("ABC_ACTION_COERCE"));
                     log_abc("COERCE: object for conversion is %s, "
                             "desired type %s", value,
                             mST.value(a.getGlobalName()));

=== modified file 'testsuite/Makefile.am'
--- a/testsuite/Makefile.am     2009-06-17 18:12:08 +0000
+++ b/testsuite/Makefile.am     2009-06-18 08:46:14 +0000
@@ -49,12 +49,12 @@
 endif
 
 if ENABLE_AS3COMPILE
-DIR_AS3 = as3
+DIR_AS3 = as3compile.all
 endif
 
 DIST_SUBDIRS = \
        media \
-       as3 \
+       as3compile.all \
        actionscript.all \
        libbase.all     \
        libamf.all \

=== renamed directory 'testsuite/as3' => 'testsuite/as3compile.all'
=== modified file 'testsuite/as3compile.all/Makefile.am'
--- a/testsuite/as3/Makefile.am 2009-06-16 11:59:37 +0000
+++ b/testsuite/as3compile.all/Makefile.am      2009-06-18 08:46:14 +0000
@@ -18,14 +18,12 @@
 
 AUTOMAKE_OPTIONS = dejagnu
 
-if ENABLE_HAXE
-SUBDIRS = classes.all
-endif
-
 # These will get executed and parsed for test output
 SANE_AS3TESTS = \
        basic.as \
        class.as \
+       lookup.as \
+       function.as \
        $(NULL)
 
 BOGUS_AS3TESTS = \

=== added file 'testsuite/as3compile.all/function.as'
--- a/testsuite/as3compile.all/function.as      1970-01-01 00:00:00 +0000
+++ b/testsuite/as3compile.all/function.as      2009-06-18 09:08:21 +0000
@@ -0,0 +1,105 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "check.as"
+
+package p1 {
+    public class A {
+        public function a() { return "string"; }
+        public function b() { return 9; }
+        public function c() { return 5.65; }
+        public function d() { return new Object(); }
+        public function e(a1) { return a1; }
+        public function f(a1, a2) { return a1 + a2; }
+        public function g() {}
+        public function h() { return c(); }
+        public function i() { return h(); }
+        public function j() { return bb(); }
+
+        public static function aa() { return "string"; }
+        public static function bb() { return 10; }
+        public static function cc() { return 2.45; }
+        public static function dd() { return new Object(); }
+        public static function ee(a1) { return a1; }
+        public static function ff(a1, a2) { return a1 + a2; }
+        public static function gg() {}
+    }
+}
+        
+
+import flash.display.MovieClip;
+
+public class Main extends MovieClip {
+
+    DEJAGNU_OBJ;
+
+    import p1.A;
+
+    public function Main() {
+
+        xcheck_equals(A.aa, "function Function() {}");
+        check_equals(typeof(A.aa), "function");
+        
+        check_equals(A.aa(), "string");
+        check_equals(typeof(A.aa()), "string");
+        check_equals(A.bb(), 10);
+        check_equals(typeof(A.bb()), "number");
+        check_equals(A.cc(), 2.45);
+        check_equals(typeof(A.cc()), "number");
+        xcheck_equals(A.dd(), "[object Object]");
+        check_equals(typeof(A.dd()), "object");
+        check_equals(A.ee("f"), "f");
+        check_equals(typeof(A.ee("f")), typeof("f"));
+        check_equals(A.ee(45), 45);
+        check_equals(typeof(A.ee(45)), typeof(45));
+        check_equals(A.ff(45, 6), 51);
+        check_equals(typeof(A.ff(45, 6)), typeof(51));
+        check_equals(A.gg(), undefined);
+        check_equals(typeof(A.gg()), "undefined");
+        
+
+        var a = new A();
+        check_equals(a.a(), "string");
+        check_equals(typeof(a.a()), "string");
+        check_equals(a.b(), 9);
+        check_equals(typeof(a.b()), "number");
+        check_equals(a.c(), 5.65);
+        check_equals(typeof(a.c()), "number");
+        xcheck_equals(a.d(), "[object Object]");
+        check_equals(typeof(a.d()), "object");
+        check_equals(a.e("f"), "f");
+        check_equals(typeof(a.e("f")), typeof("f"));
+        check_equals(a.e(45), 45);
+        check_equals(typeof(a.e(45)), typeof(45));
+        check_equals(a.f(45, 6), 51);
+        check_equals(typeof(a.f(45, 6)), typeof(51));
+        check_equals(a.g(), undefined);
+        check_equals(typeof(a.g()), "undefined");
+
+        check_equals(a.h(), a.c());
+        check_equals(a.i(), a.h());
+        check_equals(a.i(), 5.65);
+        check_equals(a.j(), A.bb());
+        check_equals(a.j(), 10);
+        
+        check_equals(a.f(a.h(), a.i()), 11.30);
+
+        totals(40);
+        done();
+    }
+}
+         

=== added file 'testsuite/as3compile.all/lookup.as'
--- a/testsuite/as3compile.all/lookup.as        1970-01-01 00:00:00 +0000
+++ b/testsuite/as3compile.all/lookup.as        2009-06-18 08:38:16 +0000
@@ -0,0 +1,56 @@
+//
+//   Copyright (C) 2005, 2006, 2007, 2009 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+#include "check.as"
+
+package p1 {
+    class A { public function id() { return "p1.A"; } }
+    class B { public static function id() { return "p1.B"; } }
+}
+
+package p2 {
+    class A { public function id() { return "p2.A"; } }
+    class B { public static function id() { return "p2.B"; } }
+    class C {}
+}
+
+import flash.display.MovieClip;
+
+public class Main extends MovieClip {
+
+    DEJAGNU_OBJ;
+
+    import p1.*;
+    import p2.*;
+
+    public function Main() {
+
+        var a = new A();
+
+        // Check that functions work at all...
+        check_equals(typeof(a.id()), "string");
+
+        // Check non-static function lookup
+        xcheck_equals(a.id(), "p1.A");
+        
+        // Check static function lookup.
+        check_equals(B.id(), "p1.B");
+
+        done();
+    }
+}
+         

=== modified file 'testsuite/misc-haxe.all/Makefile.am'
--- a/testsuite/misc-haxe.all/Makefile.am       2009-06-12 20:50:23 +0000
+++ b/testsuite/misc-haxe.all/Makefile.am       2009-06-18 08:46:14 +0000
@@ -18,6 +18,8 @@
 
 AUTOMAKE_OPTIONS = dejagnu
 
+SUBDIRS = classes.all
+
 # These will get executed and parsed for test output
 SANE_ASTESTS = \
        $(NULL)

=== renamed directory 'testsuite/as3/classes.all' => 
'testsuite/misc-haxe.all/classes.all'
=== renamed directory 'testsuite/as3/internal.all' => 
'testsuite/misc-haxe.all/internal.all'

reply via email to

[Prev in Thread] Current Thread [Next in Thread]