date-methods-this-error.js (572B)
1 load(libdir + "asserts.js"); 2 3 let ignored = [ 4 "constructor", 5 "toJSON", // Generic, but calls toISOString 6 "toGMTString", // Same method as toUTCString 7 ] 8 9 let methods = Object.getOwnPropertyNames(Date.prototype) 10 .filter(name => !ignored.includes(name)); 11 12 for (let method of methods) { 13 assertTypeErrorMessage(() => Date.prototype[method].call(new Map), 14 `Date.prototype.${method} called on incompatible Map`); 15 16 assertTypeErrorMessage(() => Date.prototype[method].call(false), 17 `Date.prototype.${method} called on incompatible boolean`); 18 }