mirror of
https://github.com/tc39/test262.git
synced 2025-05-30 11:40:30 +02:00
This copies over the tests that previously existed in the tc39/proposal-temporal repository. For context, see thread starting at: https://github.com/tc39/test262/issues/3002#issuecomment-926234480 In service of https://github.com/tc39/test262/issues/3002
36 lines
856 B
JavaScript
36 lines
856 B
JavaScript
// 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-comparetemporaltime
|
|
description: compare() ignores the observable properties and uses internal slots
|
|
features: [Temporal]
|
|
---*/
|
|
|
|
function CustomError() {}
|
|
|
|
class AvoidGettersTime extends Temporal.PlainTime {
|
|
get hour() {
|
|
throw new CustomError();
|
|
}
|
|
get minute() {
|
|
throw new CustomError();
|
|
}
|
|
get second() {
|
|
throw new CustomError();
|
|
}
|
|
get millisecond() {
|
|
throw new CustomError();
|
|
}
|
|
get microsecond() {
|
|
throw new CustomError();
|
|
}
|
|
get nanosecond() {
|
|
throw new CustomError();
|
|
}
|
|
}
|
|
|
|
const one = new AvoidGettersTime(12, 34, 56, 987, 654, 321);
|
|
const two = new AvoidGettersTime(6, 54, 32, 123, 456, 789);
|
|
assert.sameValue(Temporal.PlainTime.compare(one, two), 1);
|