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/Func...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog testsuite/actionscript.all/Func...
Date: Mon, 19 Mar 2007 17:37:10 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/03/19 17:37:09

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

Log message:
                * testsuite/actionscript.all/Function.as: add more tests
                  for 'constructor', '__constructor__' and super.
                  A lot of them fail and the test is still not complete.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2629&r2=1.2630
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/Function.as?cvsroot=gnash&r1=1.27&r2=1.28

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2629
retrieving revision 1.2630
diff -u -b -r1.2629 -r1.2630
--- ChangeLog   19 Mar 2007 17:12:55 -0000      1.2629
+++ ChangeLog   19 Mar 2007 17:37:09 -0000      1.2630
@@ -1,3 +1,9 @@
+2007-03-19 Sandro Santilli <address@hidden>
+
+       * testsuite/actionscript.all/Function.as: add more tests
+         for 'constructor', '__constructor__' and super.
+         A lot of them fail and the test is still not complete.
+
 2007-03-19 Ann Barcomb <address@hidden>
 
        * doc/C/actionscript/new_as_class.xml: document the changed syntax

Index: testsuite/actionscript.all/Function.as
===================================================================
RCS file: /sources/gnash/gnash/testsuite/actionscript.all/Function.as,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- testsuite/actionscript.all/Function.as      16 Mar 2007 16:40:17 -0000      
1.27
+++ testsuite/actionscript.all/Function.as      19 Mar 2007 17:37:09 -0000      
1.28
@@ -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: Function.as,v 1.27 2007/03/16 16:40:17 strk Exp $";
+rcsid="$Id: Function.as,v 1.28 2007/03/19 17:37:09 strk Exp $";
 
 #include "check.as"
 
@@ -444,3 +444,124 @@
 // expect '[type Function]', not 'custom text rep' in output (no way to check 
this!!)
 note(textOutFunc);
 
+
+//-----------------------------------------------------
+// Test constructor and __constructor__ properties
+//-----------------------------------------------------
+
+a = 4; // number primitive to Number object
+check_equals(typeof(a.constructor), 'function');
+#if OUTPUT_VERSION > 5
+xcheck_equals(typeof(a.__constructor__), 'function');
+#if OUTPUT_VERSION == 6
+xcheck(a.hasOwnProperty('constructor'));
+#else
+check(!a.hasOwnProperty('constructor'));
+#endif
+xcheck(a.hasOwnProperty('__constructor__'));
+check_equals(a.constructor, Number);
+xcheck_equals(a.__constructor__, Number);
+check(! a instanceof Number);
+check(a.constructor != Object);
+#endif
+
+a = "string"; // string primitive to String object
+check_equals(typeof(a.constructor), 'function');
+#if OUTPUT_VERSION > 5
+xcheck_equals(typeof(a.__constructor__), 'function');
+#if OUTPUT_VERSION == 6
+xcheck(a.hasOwnProperty('constructor'));
+#else
+check(!a.hasOwnProperty('constructor'));
+#endif
+xcheck(a.hasOwnProperty('__constructor__'));
+check_equals(a.constructor, String);
+xcheck_equals(a.__constructor__, String);
+check(! a instanceof String);
+check(a.constructor != Object);
+#endif
+
+a = true; // boolean primitive to Boolean object
+xcheck_equals(typeof(a.constructor), 'function');
+#if OUTPUT_VERSION > 5
+xcheck_equals(typeof(a.__constructor__), 'function');
+#if OUTPUT_VERSION == 6
+xcheck(a.hasOwnProperty('constructor'));
+#else
+check(!a.hasOwnProperty('constructor'));
+#endif
+xcheck(a.hasOwnProperty('__constructor__'));
+xcheck_equals(a.constructor, Boolean);
+xcheck_equals(a.__constructor__, Boolean);
+check(! a instanceof String);
+check(a.constructor != Object);
+#endif
+
+//-----------------------------------------------------
+// Test use of 'super'
+//-----------------------------------------------------
+
+function Mail(recipient, message)
+{
+       this.to = recipient;
+       this.message = message;
+}
+
+function Email(subject, recipient, message)
+{
+       this.subject = subject;
+
+#if OUTPUT_VERSION > 5
+       check_equals(typeof(super), 'object');
+#else // OUTPUT_VERSION <= 5
+       check_equals(typeof(super), 'undefined');
+#endif
+       super(recipient, message);
+}
+
+check_equals(typeof(Email.prototype.__constructor__), 'undefined');
+
+// Email is a Function instance, and it's "constructor" property
+// tells us so
+check_equals(typeof(Email.constructor), 'function');
+check_equals(Email.constructor, Function);
+#if OUTPUT_VERSION > 5
+xcheck(Email.hasOwnProperty('constructor'));
+#endif // OUTPUT_VERSION > 5
+
+// Anyway, Email was not created using 'new', so it does
+// not have a __constructor__ property
+check_equals(typeof(Email.__constructor__), 'undefined');
+check( ! Email.hasOwnProperty('__constructor__') );
+
+Email.prototype = new Mail;
+#if OUTPUT_VERSION > 5 
+check_equals(typeof(Email.prototype.__constructor__), 'function');
+#else
+check_equals(typeof(Email.prototype.__constructor__), 'undefined');
+#endif
+
+myMail = new Email('greetings', "you", "hello");
+check_equals(myMail.subject, 'greetings');
+
+#if OUTPUT_VERSION > 5
+xcheck_equals(myMail.to, 'you');
+xcheck_equals(myMail.message, 'hello');
+#else // OUTPUT_VERSION <= 5
+// no 'super' defined for SWF5 and below, so don't expect it to be called
+check_equals(typeof(myMail.to), 'undefined');
+check_equals(typeof(myMail.message), 'undefined');
+#endif
+
+function Spam()
+{
+       this.to = 'everyone';
+       this.message = 'enlarge yourself';
+}
+
+Email.prototype.__constructor__ = Spam;
+
+myMail = new Email('greetings', "you", "hello");
+check_equals(myMail.subject, 'greetings');
+xcheck_equals(myMail.to, 'everyone');
+xcheck_equals(myMail.message, 'enlarge yourself');




reply via email to

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