gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Inhe...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Inhe...
Date: Sun, 31 Dec 2006 13:59:21 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  06/12/31 13:59:21

Modified files:
        .              : ChangeLog 
        testsuite/actionscript.all: Inheritance.as 

Log message:
                * testsuite/actionscript.all/Inheritance.as: added test
                  for using 'super' from within a function (failing).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2023&r2=1.2024
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Inheritance.as?cvsroot=gnash&r1=1.10&r2=1.11

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2023
retrieving revision 1.2024
diff -u -b -r1.2023 -r1.2024
--- ChangeLog   31 Dec 2006 11:26:18 -0000      1.2023
+++ ChangeLog   31 Dec 2006 13:59:21 -0000      1.2024
@@ -1,5 +1,7 @@
 2006-12-31 Sandro Santilli <address@hidden>
 
+       * testsuite/actionscript.all/Inheritance.as: added test
+         for using 'super' from within a function (failing).
        * testsuite/misc-ming.all/ming_utils.h:
          Include filename in test result messages.
        * testsuite/misc-ming.all/: Makefile.am, place_object_test.c,

Index: testsuite/actionscript.all/Inheritance.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Inheritance.as,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- testsuite/actionscript.all/Inheritance.as   5 Nov 2006 00:45:27 -0000       
1.10
+++ testsuite/actionscript.all/Inheritance.as   31 Dec 2006 13:59:21 -0000      
1.11
@@ -20,7 +20,7 @@
 // compile this test case with Ming makeswf, and then
 // execute it like this gnash -1 -r 0 -v out.swf
 
-rcsid="$Id: Inheritance.as,v 1.10 2006/11/05 00:45:27 rsavoye Exp $";
+rcsid="$Id: Inheritance.as,v 1.11 2006/12/31 13:59:21 strk Exp $";
 
 #include "check.as"
 
@@ -84,26 +84,52 @@
 check(myBall.__proto__ == Ball.prototype);
 
 // Define a superclass
-function Super() {
-       this.sayHello = function() { return "hello from Super"; };
+function SuperClass() {
+       this.sayHello = function() { return "hello from SuperClass"; };
 }
 
-// Define a class derived from Super
-function Sub () {}
-Sub.prototype = new Super();
-subInstance = new Sub();
-check(subInstance.sayHello() == "hello from Super" );
-Sub.prototype.sayHello = function() { return "hello from Sub"; };
-check(subInstance.sayHello() == "hello from Sub" );
+// Define a class derived from SuperClass
+function SubClass () {}
+SubClass.prototype = new SuperClass();
+subInstance = new SubClass();
+check_equals(subInstance.sayHello(), "hello from SuperClass" );
+SubClass.prototype.sayHello = function() { return "hello from SubClass"; };
+check_equals(subInstance.sayHello(), "hello from SubClass" );
 subInstance.sayHello = function() { return "hello from subInstance"; };
-check(subInstance.sayHello() == "hello from subInstance" );
+check_equals(subInstance.sayHello(), "hello from subInstance" );
 
 // Test the instanceOf operator
-check(subInstance instanceOf Sub);
-check(subInstance instanceOf Super);
+check(subInstance instanceOf SubClass);
+check(subInstance instanceOf SuperClass);
 check(subInstance instanceOf Object);
 
 
+//------------------------------------------------
+// Test the 'super' keyword
+//------------------------------------------------
+
+function BaseClass() {}
+BaseClass.prototype.sayHello = function () {
+  return "Hello from BaseClass"; 
+};
+function DerivedClass() {}
+DerivedClass.prototype = new BaseClass();
+DerivedClass.prototype.sayHello = function () {
+  return "Hello from DerivedClass"; 
+};
+DerivedClass.prototype.saySuperHello = function () {
+  return super.sayHello();
+};
+var derived = new DerivedClass();
+var greeting = derived.saySuperHello();
+xcheck_equals(greeting, "Hello from BaseClass");
+check_equals(super, undefined);
+
+//------------------------------------------------
+//
+//------------------------------------------------
+
+
 /// THese have been moved here from inheritance.as
 var obj = new Object({a:1});
 




reply via email to

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