mirror of https://github.com/tc39/test262.git
Temporal: Add missing valueOf tests.
This commit is contained in:
parent
bb926a1796
commit
267aab37c2
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.instant.prototype.valueof
|
||||
description: Basic tests for valueOf().
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const instant = new Temporal.Instant(100n);
|
||||
const instant2 = new Temporal.Instant(987654321n);
|
||||
|
||||
assert.throws(TypeError, () => instant.valueOf(), "valueOf");
|
||||
assert.throws(TypeError, () => instant < instant, "<");
|
||||
assert.throws(TypeError, () => instant <= instant, "<=");
|
||||
assert.throws(TypeError, () => instant > instant, ">");
|
||||
assert.throws(TypeError, () => instant >= instant, ">=");
|
||||
assert.sameValue(instant === instant, true, "===");
|
||||
assert.sameValue(instant === instant2, false, "===");
|
||||
assert.sameValue(instant !== instant, false, "!==");
|
||||
assert.sameValue(instant !== instant2, true, "!==");
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (C) 2022 Igalia, S.L. All rights reserved.
|
||||
// This code is governed by the BSD license found in the LICENSE file.
|
||||
|
||||
/*---
|
||||
esid: sec-temporal.zoneddatetime.prototype.valueof
|
||||
description: Basic tests for valueOf().
|
||||
features: [Temporal]
|
||||
---*/
|
||||
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(100n, "UTC");
|
||||
const zonedDateTime2 = new Temporal.ZonedDateTime(987654321n, "UTC");
|
||||
|
||||
assert.throws(TypeError, () => zonedDateTime.valueOf(), "valueOf");
|
||||
assert.throws(TypeError, () => zonedDateTime < zonedDateTime, "<");
|
||||
assert.throws(TypeError, () => zonedDateTime <= zonedDateTime, "<=");
|
||||
assert.throws(TypeError, () => zonedDateTime > zonedDateTime, ">");
|
||||
assert.throws(TypeError, () => zonedDateTime >= zonedDateTime, ">=");
|
||||
assert.sameValue(zonedDateTime === zonedDateTime, true, "===");
|
||||
assert.sameValue(zonedDateTime === zonedDateTime2, false, "===");
|
||||
assert.sameValue(zonedDateTime !== zonedDateTime, false, "!==");
|
||||
assert.sameValue(zonedDateTime !== zonedDateTime2, true, "!==");
|
Loading…
Reference in New Issue