CVSROOT: /sources/gnash Module name: gnash Changes by: Zou Lunkai <zoulunkai> 07/08/27 06:38:24
Modified files: . : ChangeLog testsuite/actionscript.all: toString_valueOf.as Log message: * testsuite/actionscript.all/toString_valueOf.as: more tests for deduction. CVSWeb URLs: http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4110&r2=1.4111 http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/actionscript.all/toString_valueOf.as?cvsroot=gnash&r1=1.7&r2=1.8 Patches: Index: ChangeLog =================================================================== RCS file: /sources/gnash/gnash/ChangeLog,v retrieving revision 1.4110 retrieving revision 1.4111 diff -u -b -r1.4110 -r1.4111 --- ChangeLog 27 Aug 2007 03:41:42 -0000 1.4110 +++ ChangeLog 27 Aug 2007 06:38:23 -0000 1.4111 @@ -1,6 +1,7 @@ 2007-08-27 Zou Lunkai <[EMAIL PROTECTED]> * testsuite/actionscript.all/ops.as: more tests about NaN. + * testsuite/actionscript.all/toString_valueOf.as: more tests for deduction. 2007-08-27 Chad Musick <[EMAIL PROTECTED]> Index: testsuite/actionscript.all/toString_valueOf.as =================================================================== RCS file: /sources/gnash/gnash/testsuite/actionscript.all/toString_valueOf.as,v retrieving revision 1.7 retrieving revision 1.8 diff -u -b -r1.7 -r1.8 --- testsuite/actionscript.all/toString_valueOf.as 25 Aug 2007 21:38:49 -0000 1.7 +++ testsuite/actionscript.all/toString_valueOf.as 27 Aug 2007 06:38:24 -0000 1.8 @@ -24,6 +24,38 @@ #include "check.as" // +//Testing toString and valueOf of Function +// +#if OUTPUT_VERSION > 5 + check_equals(typeof(Function), 'function'); + + check(Function.prototype.hasOwnProperty('apply')); + check(Function.prototype.hasOwnProperty('call')); + xcheck(Function.prototype.hasOwnProperty('__proto__')); + check(Function.prototype.hasOwnProperty('constructor')); + + check(!Function.prototype.hasOwnProperty('toString')); + check(!Function.prototype.hasOwnProperty('valueOf')); + + check(Function.prototype.__proto__.hasOwnProperty('toString')); + check(Function.prototype.__proto__.hasOwnProperty('valueOf')); + + check_equals(typeof(Function.prototype['toString']), 'function'); + check_equals(typeof(Function.prototype['valueOf']), 'function'); +#else + // No Function Object in swf5??? + xcheck_equals(typeof(Function), 'undefined'); + + // Function Object in swf5 does not support toString and valueOf + xcheck_equals(Function.prototype['toString'], undefined); + xcheck_equals(Function.prototype['valueOf'], undefined); + + // test 'function' is supported in swf5:) + x = function () {}; + check_equals(typeof(x), 'function'); +#endif + +// //Testing toString and valueOf of Object // #if OUTPUT_VERSION > 5 @@ -32,8 +64,13 @@ #else // swf5 does not support hasOwnProperty method check(typeof(hasOwnProperty) == 'undefined'); - check(!Object.prototype.hasOwnProperty('toString')); - check(!Object.prototype.hasOwnProperty('valueOf')); + // Object object still supports toString and valueOf in swf5 + check_equals(typeof(Object.prototype['toString']), 'function'); + check_equals(typeof(Object.prototype['valueOf']), 'function'); + // this is true because Function object in swf5 does not + // support toString and valueOf. + xcheck_equals(Object.prototype.toString, undefined); + xcheck_equals(Object.prototype.valueOf, undefined); #endif obj = new Object(); @@ -57,9 +94,11 @@ check(obj.valueOf != Object.prototype.valueOf); #else // this is true only in swf5 (any function is equal to any other in SWF5) - xcheck(obj.toString == Object.prototype.toString); - xcheck(obj.valueOf == Object.prototype.valueOf); + xcheck(obj.toString == undefined); + xcheck(obj.valueOf == undefined); xcheck(obj.toString == obj.valueOf); + xcheck(Object.prototype.toString == undefined); + xcheck(Object.prototype.valueOf == undefined); #endif x = obj.toString(); y = obj.valueOf(); @@ -81,8 +120,8 @@ check(Number.prototype.valueOf != Object.prototype.valueOf); #else // this is true only in swf5 - xcheck(Number.prototype.toString == Object.prototype.toString); - xcheck(Number.prototype.valueOf == Object.prototype.valueOf); + xcheck(Number.prototype.toString == undefined); + xcheck(Number.prototype.valueOf == undefined); #endif @@ -121,8 +160,8 @@ check(String.prototype.valueOf != Object.prototype.valueOf); #else // this is true only in swf5 - xcheck(String.prototype.toString == Object.prototype.toString); - xcheck(String.prototype.valueOf == Object.prototype.valueOf); + xcheck(String.prototype.toString == undefined); + xcheck(String.prototype.valueOf == undefined); #endif str1 = new String("10"); @@ -275,6 +314,10 @@ // For Buttons, this true from swf5~swf8! xcheck(Button.prototype.toString == Object.prototype.toString); xcheck(Button.prototype.valueOf == Object.prototype.valueOf); +#if OUTPUT_VERSION == 5 +check_equals(Button.prototype.toString, undefined); +check_equals(Button.prototype.valueOf, undefined); +#endif btn1 = new Button(); xcheck(typeof(btn1) == "object"); @@ -297,8 +340,8 @@ check(Boolean.prototype.toString != Object.prototype.toString); check(Boolean.prototype.valueOf != Object.prototype.valueOf); #else - xcheck(Boolean.prototype.toString == Object.prototype.toString); - xcheck(Boolean.prototype.valueOf == Object.prototype.valueOf); + xcheck(Boolean.prototype.toString == undefined); + xcheck(Boolean.prototype.valueOf == undefined); #endif b1 = new Boolean(false); @@ -325,8 +368,8 @@ check(Date.prototype.toString != Object.prototype.toString); check(Date.prototype.valueOf != Object.prototype.valueOf); #else - xcheck(Date.prototype.toString == Object.prototype.toString); - xcheck(Date.prototype.valueOf == Object.prototype.valueOf); + xcheck(Date.prototype.toString == undefined); + xcheck(Date.prototype.valueOf == undefined); #endif d1 = new Date(0); @@ -364,7 +407,7 @@ check(!Array.prototype.hasOwnProperty('valueOf')); check(Array.prototype.toString != Object.prototype.toString); #else - xcheck(Array.prototype.toString == Object.prototype.toString); + xcheck(Array.prototype.toString == undefined); #endif check(Array.prototype.valueOf == Object.prototype.valueOf); _______________________________________________ Gnash-commit mailing list Gnash-commit@gnu.org http://lists.gnu.org/mailman/listinfo/gnash-commit