mirror of
https://github.com/tc39/test262.git
synced 2025-04-08 19:35:28 +02:00
Add DateTimeFormat tests for OrdinaryHasInstance
Add tests to make sure DateTimeFormat does not call the instanceof operator and calls OrdinaryHasInstance instead. Refs: https://github.com/tc39/ecma402/pull/500
This commit is contained in:
parent
76ab0187c0
commit
f6034ebe9f
16
test/intl402/DateTimeFormat/constructor-no-instanceof.js
Normal file
16
test/intl402/DateTimeFormat/constructor-no-instanceof.js
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (C) 2021 Igalia S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.DateTimeFormat.prototype.resolvedOptions
|
||||
description: >
|
||||
Tests that Intl.DateTimeFormat.prototype.resolvedOptions calls
|
||||
OrdinaryHasInstance instead of the instanceof operator which includes a
|
||||
Symbol.hasInstance lookup and call among other things.
|
||||
---*/
|
||||
|
||||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
|
||||
get() { throw new Test262Error(); }
|
||||
});
|
||||
|
||||
Intl.DateTimeFormat();
|
18
test/intl402/DateTimeFormat/prototype/format/no-instanceof.js
vendored
Normal file
18
test/intl402/DateTimeFormat/prototype/format/no-instanceof.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.DateTimeFormat.prototype.resolvedOptions
|
||||
description: >
|
||||
Tests that Intl.DateTimeFormat.prototype.resolvedOptions calls
|
||||
OrdinaryHasInstance instead of the instanceof operator which includes a
|
||||
Symbol.hasInstance lookup and call among other things.
|
||||
---*/
|
||||
|
||||
const dtf = new Intl.DateTimeFormat();
|
||||
|
||||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
|
||||
get() { throw new Test262Error(); }
|
||||
});
|
||||
|
||||
dtf.format;
|
18
test/intl402/DateTimeFormat/prototype/resolvedOptions/no-instanceof.js
vendored
Normal file
18
test/intl402/DateTimeFormat/prototype/resolvedOptions/no-instanceof.js
vendored
Normal file
@ -0,0 +1,18 @@
|
||||
// Copyright (C) 2021 Igalia S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-Intl.DateTimeFormat.prototype.resolvedOptions
|
||||
description: >
|
||||
Tests that Intl.DateTimeFormat.prototype.resolvedOptions calls
|
||||
OrdinaryHasInstance instead of the instanceof operator which includes a
|
||||
Symbol.hasInstance lookup and call among other things.
|
||||
---*/
|
||||
|
||||
const dtf = new Intl.DateTimeFormat();
|
||||
|
||||
Object.defineProperty(Intl.DateTimeFormat, Symbol.hasInstance, {
|
||||
get() { throw new Test262Error(); }
|
||||
});
|
||||
|
||||
dtf.resolvedOptions();
|
Loading…
x
Reference in New Issue
Block a user