diff --git a/test/built-ins/Temporal/Instant/prototype/valueOf/basic.js b/test/built-ins/Temporal/Instant/prototype/valueOf/basic.js new file mode 100644 index 0000000000..6f4bcea9e3 --- /dev/null +++ b/test/built-ins/Temporal/Instant/prototype/valueOf/basic.js @@ -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, "!=="); diff --git a/test/built-ins/Temporal/ZonedDateTime/prototype/valueOf/basic.js b/test/built-ins/Temporal/ZonedDateTime/prototype/valueOf/basic.js new file mode 100644 index 0000000000..4d576fd022 --- /dev/null +++ b/test/built-ins/Temporal/ZonedDateTime/prototype/valueOf/basic.js @@ -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, "!==");