archives

« Bugzilla Issues Index

#1528 — Tests for Section 15.4.4.2 Array.prototype.toString() coverage related to spec


the tests in 15.4.4.2 (Array.prototype.toString) are by and large the same as the tests inherited from Sputnik, and test for ES3 behavior. The definition of this function changed from ES3 to ES5. Simply put, it changed from a 'join' synonym to a 'join' wrapper
(From Paul Ruizendaal's post in mailing list)
https://mail.mozilla.org/pipermail/test262-discuss/2013-April/000160.html


Created attachment 51
Adding more test coverage to Array.prototype.toString() from ES3 to ES5


Created attachment 52
Adding more test coverage to Array.prototype.toString() from ES3 to ES5


Created attachment 62
Test coverage to Array.prototype.toString()

Adding test coverage to Array.prototype.toString() as MS style test.


Comment on attachment 62
Test coverage to Array.prototype.toString()

NIT: Line 15 in the header of each file should be commented.


Created attachment 63
Test coverage to Array.prototype.toString()

Adding test coverage to Array.prototype.toString() as MS style test.


(In reply to comment #5)
> Created attachment 63 [details]
> Test coverage to Array.prototype.toString()
>
> Adding test coverage to Array.prototype.toString() as MS style test.
Added comments in line 15 for all test cases along with correcting a typo in the header file


Suggest to add a test for step 1 of the spec algorithm: converting this to an object using ToObject.

A test could be:

function test() {
if( Array.prototype.toString.call(5)=="[object Number]" ) return true;
return false;
}


A test for the paranoid could be verifying that indeed the "original Object.prototype.toString" is called if "join" turns out to be non callable, and not the current version of Object.prototype.toString.

function test() {
var save = Object.prototype.toString;
Object.prototype.toString = function() { return 'abab'; };
var rc = Array.prototype.toString.call(5);
Object.prototype.toString = save;
return rc==='[object Number]';
}