summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/date-methods-this-error.js
blob: b075a6e37dfe827c0dc9eacd87dec2b7189b108a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
load(libdir + "asserts.js");

let ignored = [
  "constructor",
  "toJSON", // Generic, but calls toISOString
  "toGMTString", // Same method as toUTCString
]

let methods = Object.getOwnPropertyNames(Date.prototype)
                    .filter(name => !ignored.includes(name));

for (let method of methods) {
  assertTypeErrorMessage(() => Date.prototype[method].call(new Map),
    `Date.prototype.${method} called on incompatible Map`);

  assertTypeErrorMessage(() => Date.prototype[method].call(false),
    `Date.prototype.${method} called on incompatible boolean`);
}