Tests for 15.4.4.13, Array.prototype.unshift

Paul Ruizendaal pnr at planet.nl
Sun Apr 7 13:00:29 PDT 2013


Continuing the series, now for unshift. Browser results as before.

Suggesting to add the following two tests to make sure that 'true' is passed to Put and Delete respectively:

function test() {
var a = [4,5,6];
Object.defineProperty(a, '2', {value:6, writable:false});
try {
  a.unshift(1,2,3);
  return false;
} catch(e) {
  if( e.name!=='TypeError' ) return false;
  if( a.toString()!=='1,2,6,4,5,6' ) return false;
  return true;
}
}

function test() {
var a = [4];
Object.defineProperty(a, '2', {value:6, configurable:false});
try {
  a.unshift(1);
  return false;
} catch(e) {
  if( e.name!=='TypeError' ) return false;
  if( a.toString()!=='4,,6,6' ) return false;
  return true;
}
}



More information about the test262-discuss mailing list