archives

« Bugzilla Issues Index

#30 — S15.5.4.8_A1_T11.js is invalid (representation of Date objects is implementation dependent)


S15.5.4.8_A1_T11 contains the following to test String.prototype.lastIndexOf:
var __instance = new Date(100000000);
__instance.lastIndexOf = String.prototype.lastIndexOf;

if ((__instance.lastIndexOf('1970')) !== 11) {
$ERROR('#1: __instance = new Date(0); __instance.lastIndexOf = String.prototype.lastIndexOf; __instance.lastIndexOf(\'1970\') === 11. Actual: '+(__instance.lastIndexOf('1970')) );
}
assuming that 'new Date(100000000).toString()' is constant across implementations.

By 15.9.5.2:
15.9.5.2 Date.prototype.toString ( )
This function returns a String value. The contents of the String are implementation-dependent, ...
this assumption is incorrect and Date(...).toString() could be any string really => the test case as written is invalid.


There's no way to make this one valid WRT ES5.1. Similar coverage exists in ch15/15.5/15.5.4/15.5.4.8/S15.5.4.8_A1_T1.js (and ch15/15.5/15.5.4/15.5.4.8/S15.5.4.8_A1_T2.js):
var __instance = new Boolean;
__instance.lastIndexOf = String.prototype.lastIndexOf;

so I'll simply remove it outright.