summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/Temporal/PlainDate/compare/use-internal-slots.js
blob: 2f8a0c4a2a6f8926088f924b7f83d3a89e09d520 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// |reftest| skip-if(!this.hasOwnProperty('Temporal')) -- Temporal is not enabled unconditionally
// Copyright (C) 2020 Igalia, S.L. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
esid: sec-temporal-compareisodate
description: compare() ignores the observable properties and uses internal slots
features: [Temporal]
---*/

function CustomError() {}

class AvoidGettersDate extends Temporal.PlainDate {
  get year() {
    throw new CustomError();
  }
  get month() {
    throw new CustomError();
  }
  get day() {
    throw new CustomError();
  }
}

const one = new AvoidGettersDate(2000, 5, 2);
const two = new AvoidGettersDate(2006, 3, 25);
assert.sameValue(Temporal.PlainDate.compare(one, two), -1);

reportCompare(0, 0);